My current github workflow as quite repeating code to allow a conditionnement in what and where releases should be pushed depending on the event type :
name: Build LaTeX document & latexdiff to previous tagged version.
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build stuff
...
...
- name: Upload results (master latest)
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
draft: true
title: "Build"
files: |
result
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
- name: Upload results (pull request)
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: github.ref_name
prerelease: true
draft: true
title: "Build"
files: |
result
if: ${{ github.event_name == 'pull_request' }}
- name: Upload results (tag)
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: github.ref_name
prerelease: false
draft: false
title: "Build"
files: |
result
if: ${{ github.ref_type == 'tag' }}
Is there a way to conditontionally set values so that i dont have to repeat 3 times the same thing ? Basically i want to deal with the three different cases :
- Some commit lands on master, I releas it with the
latest
tag. - Some tag lands on master, I release it with its propper tag.
- PRs are released under their names.
Not that it changes anything, but it really looks ugly to me.