Skip to content

Commit

Permalink
chore: add hotfix version job (#6401)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykBuniX authored Jul 23, 2024
1 parent 9ed690a commit 2ba155b
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release_hotfix_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test, Build and release hotfix version of packages

on:
workflow_dispatch:
inputs:
preid:
description: 'Prerelease identifier.'
default: 'hotfix'
required: true

jobs:
test_build_release_hotfix:
runs-on: ubuntu-latest
env:
COMMITTER: ${{github.event.head_commit.committer.name}}
COMMIT_URL: ${{github.event.head_commit.url}}

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set environment variables
run: |
echo "BRANCH_NAME=$(git branch --show-current)" >> $GITHUB_ENV
echo "TAG=$(git tag --points-at ${{github.sha}})" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{github.event.after}} | head -n 1)" >> $GITHUB_ENV
- name: Set TITLE
env:
PR_TITLE: ${{github.event.pull_request.title || env.COMMIT_MESSAGE}}
run: echo "TITLE=$PR_TITLE" >> $GITHUB_ENV

- name: Print environment variables
env:
GITHUB_CONTEXT: ${{toJson(github)}}
run: |
echo -e "BRANCH_NAME = ${BRANCH_NAME}"
echo -e "TAG = ${TAG}"
echo -e "TITLE = ${TITLE}"
echo -e "COMMIT_MESSAGE = ${COMMIT_MESSAGE}"
echo -e "COMMIT_URL = ${COMMIT_URL}"
echo -e "COMMITTER = ${COMMITTER}"
echo -e "HOME = ${HOME}"
echo -e "GITHUB_CONTEXT = ${GITHUB_CONTEXT}"
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'yarn'

- name: Authenticate git clone
env:
GH_TOKEN: ${{secrets.OTTO_THE_BOT_GH_TOKEN}}
run: echo -e "machine github.com\n login ${GH_TOKEN}" > ~/.netrc

- name: Install JS dependencies
run: yarn --immutable

- name: Test
run: yarn test

- name: Release hotfix versions
env:
NPM_TOKEN: ${{secrets.WEBTEAM_NPM_TOKEN}}
run: |
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> "${HOME}/.npmrc"
git config --global user.email [email protected]
git config --global user.name "Otto the Bot"
yarn hotfix-release ${{inputs.preid}}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
"new-version-beta": "lerna version prerelease --sync-workspace-lock --preid ${0} --no-changelog",
"new-publish-beta": "lerna publish from-package --dist-tag beta --preid ${0}",
"beta-release": "yarn new-version-beta ${0} && yarn new-publish-beta ${0}",
"new-version-hotfix": "lerna version patch --sync-workspace-lock --preid ${0} --no-changelog",
"new-publish-hotfix": "lerna publish from-package --dist-tag hotfix --preid ${0}",
"hotfix-release": "yarn new-version-hotfix ${0} && yarn new-publish-hotfix ${0}",
"test": "lerna run build --include-dependencies --since && lerna run test --since --parallel",
"test:all": "lerna run test",
"test:coverage": "lerna run test:coverage",
Expand Down

0 comments on commit 2ba155b

Please sign in to comment.