generated from IRNAS/irnas-projects-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infra: make publish-release workflow non-reusable
This seems to be needed to make sure that trusted publishing (see below link) works properly, since the readme says that it can't work from an reusable workflow. I ran into this issue when trying to build the release, the publish-release workflow was failing with a big amount of text: https://github.com/IRNAS/irnas-east-software/actions/runs/11718734433/job/32640627624 Relevant issues that helped to get a sense of what is happening: https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file#trusted-publishing pypi/warehouse#11096 pypa/gh-action-pypi-publish#166
- Loading branch information
1 parent
0117ecc
commit f62be2e
Showing
2 changed files
with
50 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,15 +59,59 @@ jobs: | |
with: | ||
checkout_ref: ${{ inputs.version }} | ||
|
||
call-publish-release: | ||
publish-release: | ||
needs: call-build | ||
uses: ./.github/workflows/publish-release.yaml | ||
with: | ||
release_version: ${{ inputs.version }} | ||
runs-on: ubuntu-22.04 | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/east-tool | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
contents: write | ||
|
||
steps: | ||
- name: Start | ||
run: | | ||
version_cut=$(echo "${{ inputs.version }}" | cut -c 2-) | ||
echo "release_version=${{ inputs.version }}" >> $GITHUB_ENV | ||
echo "release_version_cut=$version_cut" >> $GITHUB_ENV | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ env.release_version }} | ||
|
||
- name: Get latest Changelog entry | ||
id: changelog-reader | ||
uses: mindsers/[email protected] | ||
with: | ||
version: ${{ env.release_version_cut }} | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
# You wonder how there isn't any token? east is configured to use OIDC, | ||
# check on pypi under Publishing section what is that. | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
- name: Publish Release | ||
if: ${{ !env.ACT }} | ||
uses: softprops/[email protected] | ||
with: | ||
files: dist/* | ||
tag_name: ${{ env.release_version }} | ||
body: | | ||
# Release notes | ||
${{ steps.changelog-reader.outputs.changes }} | ||
cleanup-on-failure: | ||
# Only run cleanup if either call-build or call-publish-release fail. | ||
needs: [call-build, call-publish-release] | ||
# Only run cleanup if either call-build or publish-release fail. | ||
needs: [call-build, publish-release] | ||
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }} | ||
runs-on: ubuntu-22.04 | ||
|
||
|
This file was deleted.
Oops, something went wrong.