chore: release v1.6.0 (#145) #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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| verify: | |
| name: Verify Release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| outputs: | |
| package_file: ${{ steps.pack.outputs.package_file }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Verify tag matches package version | |
| if: github.event_name == 'push' | |
| run: | | |
| PKG_VERSION=$(node -p "require('./package.json').version") | |
| EXPECTED_TAG="v$PKG_VERSION" | |
| if [ "${GITHUB_REF_NAME}" != "$EXPECTED_TAG" ]; then | |
| echo "Tag ${GITHUB_REF_NAME} does not match package.json version $PKG_VERSION" | |
| exit 1 | |
| fi | |
| - name: Type check | |
| run: npm run typecheck | |
| - name: Run full test suite | |
| run: npm test | |
| - name: Build release artifacts | |
| run: npm run build | |
| - name: Verify committed action bundle is up to date | |
| run: git diff --exit-code -- dist action.yml | |
| - name: Pack npm artifact | |
| id: pack | |
| run: | | |
| npm pack --json > npm-pack.json | |
| PACKAGE_FILE=$(node -e "const fs = require('fs'); const data = JSON.parse(fs.readFileSync('npm-pack.json', 'utf8')); console.log(data[0].filename)") | |
| echo "package_file=${PACKAGE_FILE}" >> "$GITHUB_OUTPUT" | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: agentshield-release-artifacts | |
| path: | | |
| release-draft.md | |
| ${{ steps.pack.outputs.package_file }} | |
| if-no-files-found: error | |
| publish: | |
| name: Publish Release | |
| runs-on: ubuntu-latest | |
| needs: verify | |
| timeout-minutes: 10 | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: agentshield-release-artifacts | |
| - name: Setup Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org | |
| - name: Publish to npm | |
| run: npm publish "${{ needs.verify.outputs.package_file }}" --access public --provenance | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2 | |
| with: | |
| draft: false | |
| generate_release_notes: true | |
| body_path: release-draft.md |