Skip to content

Commit

Permalink
ci: Fix conditions for building and publishing (#313)
Browse files Browse the repository at this point in the history
* ci: Fix conditions for building and publishing

Based ont he github documentation:

github.events.ref: Is the ref of a release that has been created
github.ref: If the branch that is being used (depending on the action)
 - create a release:      It will be refs/tags/<tag_name>
 - create a pull request: It will be refs/pull/<pr_number>/merge
 - push to a branch:      It will be refs/heads/<branch_name>

For publishing to pypi, we are targeting the "create a release" event.
In which case:
 - github.events.ref will be refs/tags/<tag_name>
 - github.ref will also be refs/tags/<tag_name>

So, it looks like our IF condition was incorrect.

Ref: https://docs.github.com/en/actions/learn-github-actions/environment-variables

* ci: Remove github.event.ref and use github.ref

The github.event.ref and github.ref will always be same for the "push"
event. So, we don't need to use github.event.ref in general.
  • Loading branch information
AbdealiLoKo authored Oct 28, 2022
1 parent 8dc63f3 commit 1e118de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

builder_pypandoc_binary:
needs: [test]
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
# Ref: https://cibuildwheel.readthedocs.io/en/stable/options/#archs
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:

publisher_release:
needs: [builder_pypandoc, builder_pypandoc_binary]
if: startsWith(github.event.ref, 'refs/tags/v') && github.ref == 'refs/heads/master'
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Check out repository
Expand Down

0 comments on commit 1e118de

Please sign in to comment.