Skip to content

Commit

Permalink
Run test publish workflow on push to release/ branches (#594)
Browse files Browse the repository at this point in the history
Recently I changed the triggering event from push to pull_request. 
However, the 'branches' filter that we use so that the test-publish
is only run on release branches, has a different semantic meaning
for pull_request event --- it specifies the target branch,
not the branch that is being merged.
  • Loading branch information
danielhollas authored May 4, 2024
1 parent fc17dd6 commit 88a498a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
name: Publish on Test PyPI and PyPI
name: Publish on (Test) PyPI

on:
pull_request:
push:
# Commits pushed to release/ branches are published on Test PyPI
# if they have a new version number.
# If the version is the same, the worflow will still complete successfully,
# but the already published version on Test PyPI will not be updated.
branches:
# Commits pushed to release/ branches are published on Test PyPI if they
# have a new version number. This allows the maintainer to check the release
# before it is pushed to the actual PyPI index.
- release/**
- 'release/**'
release:
types: [published]

jobs:

build:

name: Build package
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:

publish-test:

name: Build and publish on TestPyPI
name: Publish on TestPyPI
if: github.repository_owner == 'aiidalab'

needs: [build]
Expand All @@ -73,7 +75,7 @@ jobs:

publish:

name: Build and publish on PyPI
name: Publish on PyPI
if: startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'aiidalab'

needs: [build, publish-test]
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ repos:
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--preserve-quotes]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.1
Expand Down

0 comments on commit 88a498a

Please sign in to comment.