diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..d155b73 --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,39 @@ +name: Publish npm package + +on: + push: + tags: + - "v*" + +jobs: + publish: + runs-on: local + + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: "https://registry.npmjs.org" + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Check tag matches package version + run: | + PACKAGE_VERSION="v$(node -p "require('./package.json').version")" + TAG_NAME="${GITHUB_REF_NAME:-${GITHUB_REF#refs/tags/}}" + test "$PACKAGE_VERSION" = "$TAG_NAME" + + - name: Build + run: bun run build + + - name: Publish + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}