Create GitHub releases after npm publish #13
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: npm-publish-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| typecheck: | |
| name: Typecheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install --frozen-lockfile | |
| - run: bun run typecheck | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install --frozen-lockfile | |
| - run: bun run lint | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: bun install --frozen-lockfile | |
| - run: bun test | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| needs: | |
| - typecheck | |
| - lint | |
| - unit-tests | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| - uses: oven-sh/setup-bun@v2 | |
| - run: npm install -g npm@latest | |
| - run: bun install --frozen-lockfile | |
| - run: bun run ci:version | |
| - name: Read publish version | |
| id: version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - run: bun run build | |
| - run: npm publish | |
| - name: Create GitHub release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| cat > release-notes.md <<EOF | |
| Published npm version: @prevalentware/opencode-goal-plugin@${VERSION} | |
| Validation: | |
| - Typecheck passed. | |
| - Lint passed. | |
| - Unit tests passed. | |
| - Package published to npm. | |
| EOF | |
| gh release create "v${VERSION}" \ | |
| --repo "${GITHUB_REPOSITORY}" \ | |
| --target "${GITHUB_SHA}" \ | |
| --title "v${VERSION}" \ | |
| --notes-file release-notes.md |