Release Sherlo packages #22
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: Release Sherlo packages | |
on: | |
workflow_dispatch: | |
inputs: | |
NEW_VERSION_NUMBER: | |
description: 'New version number (e.g., 1.0.1)' | |
required: false | |
jobs: | |
release-to-prod: | |
runs-on: ubuntu-latest | |
env: | |
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}} | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
NEW_VERSION_NUMBER: ${{ github.event.inputs.NEW_VERSION_NUMBER }} | |
concurrency: release-to-prod | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.18.0' | |
- name: Install dependencies | |
run: yarn | |
- name: Bump Version | |
run: npx lerna version $NEW_VERSION_NUMBER --yes --no-git-tag-version --no-push | |
- name: Build packages | |
run: yarn build | |
- name: Commit and push updated files | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "Builds and bundles for ${NEW_VERSION_NUMBER}" | |
git push origin HEAD:dev | |
- name: Configure npm | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
- name: Publish to npm | |
run: npx lerna publish from-package --yes | |
- name: Tag Commit | |
run: | | |
git tag ${{ github.event.inputs.NEW_VERSION_NUMBER }} | |
git push origin ${{ github.event.inputs.NEW_VERSION_NUMBER }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.event.inputs.NEW_VERSION_NUMBER }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: notify failure on Slack | |
if: failure() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,commit,author,action,eventName,ref,workflow,job,took |