diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec127d1..c62478e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,19 +1,20 @@ 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 @@ -21,10 +22,11 @@ jobs: 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 @@ -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 diff --git a/.nvmrc b/.nvmrc index bb52a16..22fbfc0 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.18.2 +v24.22.3