Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
name: Publish to npm.js

on:
release:
types: [published]
push:
tags:
- '*.*.*'

jobs:
publish:
runs-on: ubuntu-22.04
permissions:
contents: read
contents: write
id-token: write

steps:
- name: Clone repo
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set .nvmrc content to stage output
id: nvmrc
run: |
echo "node_version=$(cat .nvmrc | sed 's/v//g')" >> $GITHUB_OUTPUT

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: ${{ steps.nvmrc.outputs.node_version }}
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false

- name: Install dependencies
run: npm ci
Expand All @@ -47,14 +49,20 @@ jobs:
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ github.event.release.tag_name }}
tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ github.ref_name }}
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64

- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
if ! gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release create "$GITHUB_REF_NAME" --verify-tag --generate-notes
fi

# publish to npm after docker image is built and pushed.
# this to avoid publishing to npm registry before a possible docker image build failure
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: npm publish --access public
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.18.2
v24.22.3
Loading