I would like to setup my workflow to do the following:
- On any event (pull-request, push on any branches)
- Checkout code
- Build project
- Run tests
- Upload artifacts for other jobs
- Only when master is pushed
- Download artifacts from previous job
- Push GH-pages
- Only when a tag is pushed
- Download artifacts from previous job
- Create a release
- Upload artifacts to the release
In my .github/workflows
the on
directives applies to all jobs so it won't work in my case. On the other hand, the action/upload-artifact
only works within the same workflow.
What is the proper way to achieve the described workflow?
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
submodules: true
- name: Build
run: make all
- uses: actions/upload-artifact@v2
with:
name: build
path: dist/
- name: Deploy to GitHub Pages
filters: # <-----<<<< What I would like to do
branch: master
uses: JamesIves/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist/html