0

I have an Angular application, source code stored on GitHub. I want to create this pipeline to deploy the code:

  1. On push anything into the deploy-test branch, it starts the workflow.
  2. GitHub will create a runner
  3. Runner pull the code
  4. Runner start build process
  5. Runner create a new git branch, called deploy-test-build
  6. Runner push the built files to GitHub repository.
  7. The self-hosted runner watch the pushes on deploy-test-build branch, it starts another workflow.

Here is my first action file:

name: Build test

on:
  push:
    branches:
      - deploy-test

jobs:
  build:
    name: Build and Test
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        ref: deploy-test
    - name: Use Node 12.x
      uses: actions/setup-node@v1
      with:
        node-version: '12.x'
    - name: Install dependencies
      run: |
        cd angular
        npm ci
    - name: Build
      run: cd angular && npm run build:ci:test
    - name: Publish build
      run: |
        git config --global user.email "my email"
        git config --global user.name my name"
        git checkout -b deploy-test-build
        git add --force angular/dist
        git commit -m "latest build"
        git push --force origin deploy-test-build

This has this output on last step:

Run git config --global user.email "my email"
Switched to a new branch 'deploy-test-build'
[deploy-test-build d3fce92] latest build
 9 files changed, 1485 insertions(+)
 create mode 100644 dist/3rdpartylicenses.txt
 create mode 100644 dist/favicon.ico
 create mode 100644 dist/index.html
 create mode 100644 dist/main.0ac5b66d2bf9e9e9e7ab.js
 create mode 100644 dist/polyfills-es5.71ee1b4bd0370b429e7d.js
 create mode 100644 dist/polyfills.22c48ffe45b9a56d0593.js
 create mode 100644 dist/runtime.eba877d1204fd67b69cb.js
 create mode 100644 dist/scripts.7a55fdf6a96cbe55ae9f.js
 create mode 100644 dist/styles.18a91683a46b36a985e8.js
To https://github.com/myrepos-name
 + 4298d17...d3fce92 deploy-test-build -> deploy-test-build (forced update)

And the next one:

name: Deploy to test server

on:
  push:
    branches:
      - deploy-test-build

jobs:
  prepare:
    name: Prepare to clone a new version
    runs-on: self-hosted
    steps:
      # ...

But this last workflow called Deploy to test server not started.

Any idea how can I fix it?

astrochun
  • 1,642
  • 2
  • 7
  • 18
netdjw
  • 5,419
  • 21
  • 88
  • 162
  • Does deploy-test-build branch have the workflow? – soltex Mar 25 '21 at 18:39
  • Yes, the second yml file is it. Or what do you mean? – netdjw Mar 25 '21 at 19:19
  • Hi netdjw, you can use repository dispatch workflows to trigger GitHub Actions (it works across different repositories as well as for the same one). I recommend this article to see an example: https://blog.marcnuri.com/triggering-github-actions-across-different-repositories/ (you can POST to the same repository instead in your case). – GuiFalourd Mar 27 '21 at 14:53

0 Answers0