Skip to content
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

Fix a couple of bugs in the auto release workflow #1754

Merged
merged 1 commit into from
Jan 29, 2025
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
22 changes: 11 additions & 11 deletions .github/workflows/release-part-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
fi

- uses: actions/checkout@v4
if: ${{ env.RUN }}
if: env.RUN == 'true'
with:
token: ${{ secrets.AUTORELEASE_BOT_PAT }}

- name: Install dependencies
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: pip install rst2html5 setuptools_scm

- name: Get current version number (scheduled runs only)
Expand All @@ -53,18 +53,18 @@ jobs:
import os
major, minor, bugfix, *_ = os.environ['CURRENT_VERSION'].split('.')
with open(os.environ['GITHUB_ENV']) as env_file:
env_file.write(f'VERSION={major}.{minor}.{bugfix + 1}')
env_file.write(f'VERSION={major}.{minor}.{int(bugfix) + 1}')

- name: Configure git
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: |
git config user.name "GitHub Actions"
git config user.email "<>"

# Members of the natcap software team can push to the autorelease branch on
# natcap/invest; this branch is a special case for our release process.
- name: Create autorelease branch
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: git checkout -b "$AUTORELEASE_BRANCH"

# Replace
Expand All @@ -81,7 +81,7 @@ jobs:
# X.X.X (XXXX-XX-XX)
# ------------------
- name: Update HISTORY.rst
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: |
HEADER="$VERSION ($(date '+%Y-%m-%d'))"
HEADER_LENGTH=${#HEADER}
Expand All @@ -91,7 +91,7 @@ jobs:
HISTORY.rst

- name: Generate changelog.html
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: rst2html5 HISTORY.rst workbench/changelog.html

- name: Update package.json version
Expand All @@ -102,21 +102,21 @@ jobs:
package-json-path: workbench/package.json

- name: Commit updated HISTORY.rst, changelog.html, and package.json
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: |
git add HISTORY.rst
git add workbench/changelog.html
git add workbench/package.json
git commit -m "Committing the $VERSION release."

- name: Tag and push
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: |
git tag $VERSION
git push --atomic origin $AUTORELEASE_BRANCH $VERSION

- name: Find actions run for the version tag
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: |
# wait a few seconds to make sure the actions run exists before querying it
sleep 5
Expand All @@ -128,7 +128,7 @@ jobs:
--jq .[].url)" >> $GITHUB_ENV

- name: Create a PR from the autorelease branch into main
if: ${{ env.RUN }}
if: env.RUN == 'true'
run: |
gh pr create \
--base main \
Expand Down