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

Give release action permissions to push to main #251

Merged
merged 8 commits into from
Sep 26, 2024
15 changes: 13 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,33 @@ jobs:
if: needs.check-for-release-file.outputs.has-release == 'true'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Update CHANGELOG.md and build.sbt
StepanBrychta marked this conversation as resolved.
Show resolved Hide resolved
run: |
git fetch --tags
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
python3 .github/scripts/create_release.py ${LATEST_TAG} $(pwd)
- name: Commit and push changes
- name: Configure git
# We need to give the GitHub action full repo privileges via a PAT so that it can push the release directly into main
run: |
NEW_TAG=$(cat CHANGELOG.md | grep -m1 -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+')
git config --global user.name "GitHub on behalf of Wellcome Collection"
git config --global user.email "[email protected]"

git remote set-url origin https://x-access-token:${{ secrets.FULL_REPO_PRIVILEGES_PAT }}@github.com/${{ github.repository }}.git

StepanBrychta marked this conversation as resolved.
Show resolved Hide resolved
- name: Commit and push changes
run: |
git checkout main
git pull

git add CHANGELOG.md build.sbt
git rm RELEASE.md

NEW_TAG=$(cat CHANGELOG.md | grep -m1 -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+')
git commit -m "$(printf "Release: Bump version to ${NEW_TAG}\n\n[skip ci]")"
git tag ${NEW_TAG}

git push origin main
git push origin --tags

Expand Down
Loading