npm release from PR #10
Workflow file for this run
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: npm release from PR | |
on: workflow_dispatch | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: Release to npm | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install packages | |
run: npm ci | |
- name: Set up project | |
run: npm run bootstrap | |
- name: Run tests | |
run: npm run test:patchset | |
- name: Release to NPM | |
env: | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
NPM_EMAIL: ${{secrets.NPM_EMAIL}} | |
NPM_USERNAME: ${{secrets.NPM_USERNAME}} | |
run: npm run release -- --prRelease | |
- name: Get commit message | |
run: | | |
echo "commmit_message=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_ENV | |
- name: Set up git identity | |
if: "startsWith(env.commmit_message, 'chore(release)')" | |
run: git config --global user.name "instructure-ui-ci" && git config --global user.email "[email protected]" | |
# -a -m is needed to make the tag "annotated". Lerna needs annotated tags to work correctly with verisons | |
- name: Add tag | |
if: "startsWith(env.commmit_message, 'chore(release)')" | |
run: git tag -a v$(./.github/workflows/calculateVersion.sh) -m v$(./.github/workflows/calculateVersion.sh) | |
- name: Push tags | |
if: "startsWith(env.commmit_message, 'chore(release)')" | |
run: git push origin v$(./.github/workflows/calculateVersion.sh) |