Release 0.2.7 #6
Workflow file for this run
This file contains hidden or 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: Publish to npm | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| id-token: write # required for npm provenance | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go/go.mod' | |
| cache-dependency-path: 'go/go.sum' | |
| - name: Install GCC (CGO dependency) | |
| run: sudo apt-get install -y gcc | |
| - name: Verify tag matches package version | |
| run: | | |
| TAG="${GITHUB_REF_NAME#v}" | |
| PKG_VERSION=$(node -p "require('./package.json').version") | |
| if [ "$TAG" != "$PKG_VERSION" ]; then | |
| echo "Tag ($TAG) does not match package.json version ($PKG_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Install dependencies (skip postinstall build) | |
| run: npm install --ignore-scripts | |
| - name: Build native library | |
| run: npm run build | |
| - name: Publish to npm | |
| run: npm publish --access public --provenance | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |