fix: stop reporting the override difference as uncommitted work #2
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: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| # Never restore a cache in a release build: the published artefact | |
| # should come from exactly what is in the tag. | |
| cache: "" | |
| - run: npm ci | |
| - run: npm run check | |
| - run: npm run build | |
| # A re-run of a release, or a tag pushed after publishing by hand, must not | |
| # fail the whole workflow. npm rejects republishing a version, so check | |
| # first and let the GitHub release step still run. | |
| - name: Check whether this version is already on npm | |
| id: published | |
| run: | | |
| version=$(node -p "require('./package.json').version") | |
| if npm view "opencode-github-sync@${version}" version >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| echo "::notice::opencode-github-sync@${version} is already published; skipping npm publish." | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| # Publishing uses a granular token with the 2FA bypass enabled, since the | |
| # account's second factor is a passkey and cannot produce an OTP for CI. | |
| # | |
| # npm has announced that 2FA-bypass tokens lose direct publishing around | |
| # January 2027 (https://gh.io/npm-gat-bypass2fa-deprecation). Before then | |
| # this should move to trusted publishing (OIDC), which needs no secret at | |
| # all: configure it at npmjs.com/package/opencode-github-sync/access, then | |
| # delete both the NPM_TOKEN secret and the env block below. | |
| - name: Publish to npm | |
| if: steps.published.outputs.exists == 'false' | |
| run: npm publish --access public --provenance | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create the GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true |