-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ENG-884): add semantic release into project
- Loading branch information
Tristan Watson
committed
Aug 27, 2024
1 parent
4f0febe
commit c99c8d7
Showing
4 changed files
with
6,534 additions
and
556 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Create a semantic release, including | ||
# - a package.json version number | ||
# - an updated change log file | ||
# - a Github release, which will trigger a deployment | ||
name: Create Github Release | ||
|
||
# All changes to `main` have gone through | ||
# automated checks and should have gone | ||
# through code review and manual checks | ||
# where appropriate. | ||
on: | ||
push: | ||
branches: | ||
- main | ||
# This stops us getting into an infinite loop when a release commit | ||
# is created on `main` containing the changes to CHANGE_LOG.md . | ||
# The loop could happen because we use credentials from the machine | ||
# user so that a commit to the protected `main` branch is possible | ||
# (default workflow credentials can't trigger further workflows via | ||
# events, to avoid this exact situation). | ||
paths-ignore: | ||
- "CHANGE_LOG.md" | ||
- "sonar-project.properties" | ||
jobs: | ||
semantic_release: | ||
name: semantic release | ||
runs-on: ubuntu-latest | ||
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: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: "npm" | ||
|
||
# Install. | ||
- run: npm ci | ||
|
||
# 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: npx 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 }} |
Oops, something went wrong.