From 88a498a3716bf4a7ac7aeb1335a876ad120e8536 Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Sat, 4 May 2024 15:49:04 +0100 Subject: [PATCH] Run test publish workflow on push to release/ branches (#594) 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. --- .github/workflows/publish.yml | 18 ++++++++++-------- .pre-commit-config.yaml | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f3581fcf..45a566b53 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,14 @@ --- -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] @@ -15,6 +16,7 @@ jobs: build: + name: Build package runs-on: ubuntu-latest steps: @@ -46,7 +48,7 @@ jobs: publish-test: - name: Build and publish on TestPyPI + name: Publish on TestPyPI if: github.repository_owner == 'aiidalab' needs: [build] @@ -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] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb56c439c..2fe7a6bae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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