v1.3.0 #11
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: release | |
on: | |
release: | |
types: [released] | |
jobs: | |
test-and-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18, 20] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm run lint | |
- run: npm run format:check | |
- run: npm run tsc:check | |
- run: npm run test | |
- run: npm run build | |
publish: | |
runs-on: ubuntu-latest | |
needs: test-and-build | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
- run: npm install | |
- run: npm run build | |
- name: Update version based on tag | |
run: | | |
VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') | |
echo "Updating package.json version to $VERSION" | |
npm version $VERSION --no-git-tag-version | |
- name: Commit version change | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add package.json | |
git commit -m "chore(release): update version to $VERSION" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to npm | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |