release #17
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
type: choice | |
description: Semver release type | |
required: true | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
release: | |
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- name: Set Node.js 20.10 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.10 | |
- name: Install Dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Configure Git | |
uses: fregante/setup-git-user@v1 | |
- name: Version the packages | |
id: version | |
run: | | |
./scripts/version.sh ${{ github.event.inputs.release-type }} | |
export VERSION=$(cat package.json | jq -r '.version') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Publish to npm | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_PUBLISH_TOKEN}}" >> ~/.npmrc | |
echo "registry=https://registry.npmjs.org" >> ~/.npmrc | |
npm publish --workspaces --access=public | |
rm -f ~/.npmrc | |
- name: Commit and push changes | |
run: | | |
git commit -am "chore(version): π¦ ${{ github.event.inputs.release-type }} version bump to ${{ steps.version.outputs.version }}" | |
git push |