Merge pull request #16 from moclei/fix/porter-dep-3 #18
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: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to bump (patch, minor, major)' | |
required: true | |
default: 'patch' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm ci | |
- name: Configure Git | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
- name: Bump version | |
run: | | |
VERSION=${{ github.event.inputs.version || 'patch' }} | |
npm version $VERSION -m "Bump version to %s" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push changes | |
run: | | |
git push --follow-tags | |
git pull | |
- name: Build | |
run: npm run build | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
gh release create v$VERSION --generate-notes | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |