build(package.json): bump version to 1.5.1 #77
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: Node.js Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.check.outputs.version }} | |
changed: ${{ steps.check.outputs.changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm ci | |
- run: npm run build | |
- name: Check version changes | |
id: check | |
uses: EndBug/version-check@v2 | |
publish-github: | |
needs: build | |
if: needs.build.outputs.changed == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@numbersprotocol' | |
- run: npm ci | |
- run: npm run build | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-npm: | |
needs: build | |
if: needs.build.outputs.changed == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@numbersprotocol' | |
- run: npm ci | |
- run: npm run build | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
purge-cdn-cache: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Send GET request to purge jsdelivr cache | |
run: | | |
curl --fail-with-body -X GET "https://purge.jsdelivr.net/npm/@numbersprotocol/capture-eye@latest/dist/capture-eye.bundled.js" | |
create-release: | |
needs: [build, publish-github, publish-npm] | |
runs-on: ubuntu-latest | |
if: needs.build.outputs.changed == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get changelog | |
id: changelog | |
run: | | |
echo "::set-output name=changes::$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:'%h %s')" | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.build.outputs.version }} | |
release_name: Release ${{ needs.build.outputs.version }} | |
body: | | |
Changes: | |
${{ steps.changelog.outputs.changes }} | |
draft: false | |
prerelease: false |