From 203223da431bef0abe774e87225024f08d921420 Mon Sep 17 00:00:00 2001 From: Ryan White Date: Wed, 16 Oct 2024 14:08:05 +0100 Subject: [PATCH 1/6] target correct branch name --- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 570339f..04a69b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: jobs: publish: name: Publish - uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@main + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master with: stage: prod tag: ${{ github.event.release.tag_name }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2ef400e..747972d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: test-publish: needs: - test-code - uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@main + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master with: stage: test tag: "0.0.0" From fa8e3debb6540581410ccf674a1c3399243fe71f Mon Sep 17 00:00:00 2001 From: Ryan White Date: Wed, 16 Oct 2024 14:08:19 +0100 Subject: [PATCH 2/6] minor readability changes --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 924889a..d2da5f7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,6 @@ --- name: Publish -run-name: Publish ${{ inputs.tag }} to PyPI ${{ inputs.tag }} +run-name: Publish ${{ inputs.tag }} to PyPI on: workflow_call: @@ -76,7 +76,7 @@ jobs: - determine-success with: WORKFLOW_PASSED: ${{ needs.determine-success.outputs.success == 'true' }} - SUCCESS_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":airplane: ${{ github.repository }} - Successfully deployed ${{ inputs.tag }} :large_green_circle:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Package published to PyPi successfully\"}}]}" - FAILURE_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":x: ${{ github.repository }} - Failed to deploy ${{ inputs.tag }} :x:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Failed to publish package to PyPi\"}}]}" + SUCCESS_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":airplane: ${{ github.repository }} - Successfully deployed ${{ inputs.tag }} :large_green_circle:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Package published to PyPI successfully\"}}]}" + FAILURE_PAYLOAD: "{\"blocks\":[{\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\":x: ${{ github.repository }} - Failed to deploy ${{ inputs.tag }} :x:\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"Failed to publish package to PyPI\"}}]}" secrets: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} From 7b140e821bf0bfa4d71e8fb422246d1a4c979103 Mon Sep 17 00:00:00 2001 From: Ryan White Date: Wed, 16 Oct 2024 14:09:22 +0100 Subject: [PATCH 3/6] only run determine-success on prod --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d2da5f7..a541bfe 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -53,10 +53,10 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 determine-success: + if: inputs.stage == 'prod' && always() needs: - build-and-publish runs-on: ubuntu-latest - if: always() outputs: success: ${{ steps.success.outputs.success }} steps: From d04a5bdb4680eeb598c9074ca9a113e437b9c43e Mon Sep 17 00:00:00 2001 From: Ryan White Date: Wed, 16 Oct 2024 14:14:14 +0100 Subject: [PATCH 4/6] try remove branch name --- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04a69b5..3898ef8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: jobs: publish: name: Publish - uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml with: stage: prod tag: ${{ github.event.release.tag_name }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 747972d..686e19c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: test-publish: needs: - test-code - uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml with: stage: test tag: "0.0.0" From e506e8e623b748822beb6b5acd5cdc0153e0e87f Mon Sep 17 00:00:00 2001 From: Ryan White Date: Wed, 16 Oct 2024 14:20:05 +0100 Subject: [PATCH 5/6] Revert "try remove branch name" This reverts commit d04a5bdb4680eeb598c9074ca9a113e437b9c43e. --- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3898ef8..04a69b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: jobs: publish: name: Publish - uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master with: stage: prod tag: ${{ github.event.release.tag_name }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 686e19c..747972d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: test-publish: needs: - test-code - uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master with: stage: test tag: "0.0.0" From 4111ee0e72037aec9db03e458140dc35220ae756 Mon Sep 17 00:00:00 2001 From: Ryan White Date: Wed, 16 Oct 2024 14:23:16 +0100 Subject: [PATCH 6/6] fix: trusted publisher mismatch - only run test pypi on default branch --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 747972d..1b79791 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,6 +34,7 @@ jobs: bash scripts/test.sh --ci test-publish: + if: github.event.ref_name == github.event.repository.default_branch needs: - test-code uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master