I have following jobs:
jobs:
build:
name: Build
runs-on: [ self-hosted, linux ]
steps:
- uses: actions/checkout@v2
- name: Build
run: dotnet build
unit-test:
name: Unit test
if: github.event_name != 'release'
runs-on: [ self-hosted, linux ]
needs: build
steps:
- uses: actions/checkout@v2
- name: Run tests
run: dotnet test
publish:
name: Publish artifacts.zip
runs-on: [ self-hosted, linux ]
needs: unit-test
steps:
- uses: actions/checkout@v2
- run: dotnet publish
- name: Create artifact
run: |
mkdir -p ./code
I don't want to run unit tests on release, but I still need publish to run after build and I cant figure out how to do that.
I want to change publish job to:
if github.event_name != 'release'
then needs: build
otherwise needs: unit-test
as it is now. How conditions can be defined in such case?