Merge pull request #15 from codebase/codex/release-binary-version #14
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: Promote dist-tag | |
| # Flip the npm `latest` dist-tag to an already-published version without | |
| # cutting a new release: push a tag named promote-latest-v<version>, e.g. | |
| # | |
| # git tag promote-latest-v2.0.0-pre.67 && git push origin promote-latest-v2.0.0-pre.67 | |
| # | |
| # Uses the same NPM_TOKEN as release.yml. The version must already exist | |
| # on the registry — this never publishes, only re-points the tag. | |
| on: | |
| push: | |
| tags: | |
| - "promote-latest-v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| promote: | |
| name: Point latest at the tagged version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org/" | |
| - name: Verify the version exists on npm | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#promote-latest-v}" | |
| npm view "codebase-cli@$VERSION" version | |
| - name: Re-point latest | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#promote-latest-v}" | |
| npm dist-tag add "codebase-cli@$VERSION" latest | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Mark the matching GitHub release as latest | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#promote-latest-v}" | |
| gh release edit "v$VERSION" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --prerelease=false \ | |
| --latest | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |