Deploy #5
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
name: Auto release PR | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- staging | |
workflow_dispatch: | |
permissions: | |
contents: write # to create release | |
pull-requests: write # to create release PR | |
jobs: | |
# from https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another | |
deploy-staging: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SGTPOOKI_PAT }} | |
ref: staging | |
- name: Fetch all tags | |
run: git fetch --tags | |
- name: Get latest tag | |
id: get_latest_tag | |
run: echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT | |
- name: Checkout latest tag | |
run: git checkout ${{ steps.get_latest_tag.outputs.tag }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | |
with: | |
token: ${{ secrets.SGTPOOKI_PAT }} | |
branch: staging-release | |
title: 'chore: point staging to release ${{ steps.get_latest_tag.outputs.tag }}' | |
body: 'This PR points the staging branch to release ${{ steps.get_latest_tag.outputs.tag }}.' | |
# from https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another | |
deploy-production: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SGTPOOKI_PAT }} | |
ref: production | |
- name: Ensure production branch points to latest staging | |
run: | | |
git fetch origin staging:staging | |
git reset --hard staging | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7.0.5 | |
with: | |
token: ${{ secrets.SGTPOOKI_PAT }} | |
branch: production-release | |
title: 'chore: Point production to release ${{ steps.get_latest_tag.outputs.tag }}' | |
body: 'This PR points the production branch to release ${{ steps.get_latest_tag.outputs.tag }}.' | |