Skip to content

Merge pull request #3 from oaknational/rc #6

Merge pull request #3 from oaknational/rc

Merge pull request #3 from oaknational/rc #6

Workflow file for this run

# .github/workflows/release.yml
name: Production Release Workflow
on:
push:
branches:
- production
jobs:
semantic_release:
name: semantic release
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'build') }}
steps:
- uses: actions/checkout@v4
with:
# Need this to prevent the custom Github credentials on
# the semantic release step being overridden with the
# default ones.
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- run: pnpm install
# Create Github release using semantic-release package.
# See config here release.config.js
# Note, this runs on `main` and creates the release tag.
# and updates the changelog file.
- name: do release
id: semantic_release
run: pnpm exec semantic-release
env:
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
# Don't run pre-commit or commit message hooks on this commit
HUSKY: 0
- name: Report to Slack on failure
if: ${{ steps.semantic_release.outcome == 'failure' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff'
SLACK_MESSAGE: "Semantic Release status: ${{ job.status }}"
SLACK_TITLE: Semantic Release
SLACK_USERNAME: SemanticReleaseReporter
SLACK_WEBHOOK: ${{ secrets.OAK_GITHUB_NOTIFICATION_WEBHOOK }}
backmerge_to_main:
name: backmerge to main
runs-on: ubuntu-latest
needs: semantic_release
if: ${{ !startsWith(github.event.head_commit.message, 'build') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Git
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
- name: Checkout main
run: |
git fetch origin main
git checkout main
- name: Merge production into main
run: |
git fetch --unshallow
git merge origin/production
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
run: |
git config --global push.default current
git push --set-upstream origin $BRANCH_NAME