diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 924889a..a541bfe 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: @@ -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: @@ -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 }} 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..1b79791 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,9 +34,10 @@ 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@main + uses: i-dot-ai/cruft-iai/.github/workflows/publish.yml@master with: stage: test tag: "0.0.0"