From b6615cd8a7bba5f1ade0030746f90e0ccce8120b Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 22 Jan 2026 16:48:37 +0100 Subject: [PATCH] chore(publish): add Release Please Action --- .github/workflows/release-please.yml | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/release-please.yml diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..197b302 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,61 @@ +name: Release Please + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + release-please: + outputs: + release_created: ${{ steps.release.outputs.release_created }} + release_tag: ${{ steps.release.outputs.tag_name }} + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 + id: release + with: + release-type: node + + npm-publish: + needs: release-please + if: ${{ needs.release-please.outputs.release_created }} + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + with: + node-version: lts/* + + - name: Get npm cache directory + id: npm-cache-dir + run: echo "dir=$(npm config get cache)" >> "${GITHUB_OUTPUT}" + + - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/npm-shrinkwrap.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - run: npm ci + + - name: Add package archive to GitHub release + run: gh release upload "$RELEASE_TAG" "$(npm pack)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_TAG: ${{ needs.release-please.outputs.release_tag }} + + - name: Publish to the npm registry + run: npm publish --provenance +