Skip to content

enable manual trigger for autorelease part 2 #1493 #1496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/release-part-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
branches:
- main

workflow_dispatch:
inputs:
version:
required: true
type: string

env:
GITHUB_TOKEN: ${{ secrets.AUTORELEASE_BOT_PAT }}

Expand All @@ -29,7 +35,8 @@ jobs:

publish_release:
# run this job if a PR was merged from an autorelease branch into main
if: startsWith(github.head_ref, 'autorelease') && github.event.pull_request.merged == true
# or if manually triggered, github.head_ref is undefined
if: ${{ ! github.head_ref || (startsWith(github.head_ref, 'autorelease') && github.event.pull_request.merged == true) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -38,8 +45,13 @@ jobs:
run: pip install twine

- name: Extract version from autorelease branch name
if: ${{ github.head_ref }}
run: echo "VERSION=$(echo ${{ github.head_ref }} | cut -c 13-)" >> $GITHUB_ENV

- name: Get version from manual trigger input
if: ${{ ! github.head_ref }}
run: echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV

- name: Find actions run for the $VERSION tag
run: |
echo "RUN_ID=$( \
Expand All @@ -58,8 +70,6 @@ jobs:
# move the artifacts out of the folders
mv artifacts/*/* artifacts
rm -rf artifacts/Wheel*
# verify that all 6 wheels are there
if [ `find artifacts/* | wc -l` -ne 6 ]; then exit 1; fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this check, if we change the name of the wheel artifacts, and forget to update it here, then the release will proceed without the necessary wheels. It seems like you can upload files to a release after it's published, so this shouldn't be a critical issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that sounds good.

Actually it has me thinking that the more dangerous part is the artifacts for PyPI, since we can't modify that release after it's published. Like what if we changed the artifact names from "Wheel for *". We might not have any wheels downloaded, but we might still call twine upload artifacts/natcap.invest* with the source distribution natcap.invest....tgz available.


# download each artifact separately so that the command will fail if any is missing
for artifact in Workbench-Windows-binary \
Expand Down