name: Production Release on: push: tags: - 'v*' permissions: contents: write id-token: write # Required for npm Trusted Publisher (OIDC) jobs: release: if: github.repository == 'mi-examples/qa-ai-rules' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: persist-credentials: false fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 24 registry-url: https://registry.npmjs.org/ cache: 'npm' - name: Extract version from tag id: version run: | VERSION=${GITHUB_REF_NAME#v} echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Releasing version: $VERSION" - name: Install dependencies run: npm install - name: Build run: npm run build - name: Verify build output run: | if [[ ! -d "dist" ]]; then echo "Build failed: dist directory not found" exit 1 fi echo "Build verification passed" - name: Update package version run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version - name: Publish to npm # setup-node may set NODE_AUTH_TOKEN; unset so OIDC trusted publishing is used run: | unset NODE_AUTH_TOKEN npm publish --access public - name: Create GitHub Release uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 with: tag_name: ${{ github.ref_name }} name: Release ${{ github.ref_name }} generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}