-
Notifications
You must be signed in to change notification settings - Fork 0
ci(gha): install pnpm before use; align release to appsyncjs (Node 22/24, NPM_TOKEN) #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e7ae66f
ci(gha): install pnpm before use; align release flow to appsyncjs (No…
charliecreates[bot] bfc7fea
ci(gha): use pnpm/action-setup with package_json_file to honor pinned…
charliecreates[bot] f2f0ea1
ci(gha): push-only release gating, npm auth hardening, strict tag pus…
CharlieHelps 9bcbd18
ci(gha): make determine_release tolerant of PR merge refs (fallback w…
CharlieHelps c5a49a2
Update .github/workflows/release.yml
mikecbrant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,89 +1,131 @@ | ||
| name: Test and Release | ||
| name: CI — test → gate → release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - "release/**" | ||
| - "prerelease/**" | ||
| - "**" | ||
| tags: | ||
| - "**" | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
| # Ensure only one workflow per ref is active at a time | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| # Default, least-privilege token permissions; jobs elevate as needed | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test (Node ${{ matrix.node }}) | ||
| name: Test (Node ${{ matrix.node-version }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node: [22.x, 24.x] | ||
| node-version: [22.x, 24.x] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| cache: pnpm | ||
| - uses: pnpm/action-setup@v4 | ||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| # Use the pnpm version pinned in package.json `packageManager` to avoid conflicts | ||
| package_json_file: package.json | ||
| run_install: false | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm -w run fmt:check | ||
| - run: pnpm -w run typecheck:tsgo | ||
| - name: Setup Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| cache: pnpm | ||
| cache-dependency-path: pnpm-lock.yaml | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| - name: Format check | ||
| run: pnpm -w run fmt:check | ||
| - name: Typecheck (tsgo) | ||
| run: pnpm -w run typecheck:tsgo | ||
|
|
||
| determine_release: | ||
| name: Determine release | ||
| needs: [test] | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| is_prerelease: ${{ steps.determine.outputs.is_prerelease }} | ||
| is_release: ${{ steps.determine.outputs.is_release }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| package_json_file: package.json | ||
| run_install: false | ||
| - name: Setup Node.js 24 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 24.x | ||
| cache: pnpm | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| run_install: false | ||
| - run: pnpm install --frozen-lockfile | ||
| - id: determine | ||
| cache-dependency-path: pnpm-lock.yaml | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
| - name: Compute release flags | ||
| id: determine | ||
| run: | | ||
| pnpm changeset status --output=changeset-status.json | ||
| # Changesets can error on PR merge refs; tolerate and default to no pre mode | ||
| pnpm changeset status --output=changeset-status.json || echo '{}' > changeset-status.json | ||
| PRE=$(jq -r '.preState.mode // ""' changeset-status.json) | ||
| rm -f changeset-status.json | ||
| echo "is_prerelease=$([[ $PRE = 'pre' ]] && echo true || echo false)" >> $GITHUB_OUTPUT | ||
| echo "is_release=$([[ $GITHUB_REF_NAME = 'main' ]] && echo true || echo false)" >> $GITHUB_OUTPUT | ||
|
|
||
| release: | ||
| name: Release | ||
| needs: [test, determine_release] | ||
| if: needs.determine_release.outputs.is_release == 'true' || needs.determine_release.outputs.is_prerelease == 'true' | ||
| if: ${{ github.event_name == 'push' && (needs.determine_release.outputs.is_release == 'true' || needs.determine_release.outputs.is_prerelease == 'true') }} | ||
| permissions: | ||
| contents: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - run: git config user.name "GitHubActions" && git config user.email "actions@github.com" | ||
| - uses: actions/setup-node@v4 | ||
| - name: Configure Git author (for tag/commit) | ||
| run: | | ||
| git config user.name "GitHubActions" | ||
| git config user.email "actions@github.com" | ||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| package_json_file: package.json | ||
| run_install: false | ||
| - name: Setup Node.js 24 (with npm registry) | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 24.x | ||
| cache: pnpm | ||
| cache-dependency-path: pnpm-lock.yaml | ||
| registry-url: https://registry.npmjs.org | ||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| run_install: false | ||
| - run: pnpm install --frozen-lockfile | ||
| - run: pnpm build | ||
| always-auth: true | ||
| env: | ||
| # Ensure the registry is authenticated for publish | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - name: Install dependencies | ||
| run: pnpm install --frozen-lockfile | ||
mikecbrant marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Build | ||
| run: pnpm build | ||
| - name: Publish with Changesets | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| run: | | ||
| pnpm changeset status | ||
mikecbrant marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pnpm changeset version | ||
| pnpm changeset publish | ||
| git push --follow-tags --no-verify || true | ||
| git push --follow-tags --no-verify | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.