Skip to content

Commit

Permalink
Merge pull request #251 from wellcomecollection/Give-release-action-p…
Browse files Browse the repository at this point in the history
…ermissions-to-push-to-main

Give release action permissions to push to main
  • Loading branch information
StepanBrychta authored Sep 26, 2024
2 parents d93ee53 + 41cb6bf commit 41620d9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,41 @@ 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
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: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: 129326 # App ID of the Wellcome Collection app
private-key: ${{ secrets.WELLCOME_COLLECTION_APP_PRIVATE_KEY }}

- 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:${{ steps.generate-token.outputs.token }}@github.com/${{ github.repository }}.git
- 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

0 comments on commit 41620d9

Please sign in to comment.