Skip to content

move pipeline run of tests to top level #7

move pipeline run of tests to top level

move pipeline run of tests to top level #7

Workflow file for this run

name: release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 79, Col: 13): Unrecognized named-value: 'secrets'. Located at position 42 within expression: github.event.inputs.publish == 'true' && secrets.NPM_TOKEN != ''
on:
workflow_dispatch:
inputs:
bump:
type: choice
description: 'Version bump'
default: 'patch'
options: [patch, minor, major]
publish:
type: boolean
description: 'Publish to npm'
default: true
permissions:
contents: write
id-token: write
jobs:
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 22
cache: 'yarn'
- name: Enable Corepack & install
run: |
corepack enable
yarn install --immutable
# Bump version, commit, tag
- name: Bump version
id: bump
run: |
BUMP="${{ github.event.inputs.bump }}"
NEW=$(npm version "$BUMP" --no-git-tag-version)
echo "new=${NEW#v}" >> $GITHUB_OUTPUT
git add package.json
git commit -m "chore: release v${NEW#v}" || true
git tag "v${NEW#v}"
# Optional: run your E2E bin test
- name: E2E pack test
run: |
if [ -f "scripts/test-e2e.mjs" ]; then
node scripts/test-e2e.mjs
fi
# Assert npm tarball content
- name: npm pack & assert contents
run: |
TARBALL=$(npm pack --json | jq -r '.[0].filename')
tar -tf "$TARBALL" | sort > actual.txt
printf '%s\n' 'package.json' 'LICENSE' 'README.md' 'js/tools/audit/audit-auto-approve.ts' > expected.txt
sort expected.txt -o expected.txt
diff -u expected.txt actual.txt
- name: Push tag & main
run: |
git push origin HEAD:main
git push origin --tags
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.bump.outputs.new }}
name: v${{ steps.bump.outputs.new }}
generate_release_notes: true
- name: Publish to npm
if: ${{ github.event.inputs.publish == 'true' && secrets.NPM_TOKEN != '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
npm publish --provenance --access public