rc: salamander #109
Workflow file for this run
This file contains 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 to @rc-<name> tag on npm | |
on: | |
pull_request: | |
branches: | |
- "master" | |
jobs: | |
release-pr: | |
# Switch to `true` for release candidates | |
if: ${{ true && startsWith(github.head_ref, 'rc/') }} | |
name: "Release RC to npm" | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: CI Setup | |
uses: ./.github/actions/ci-setup | |
- name: Ensure NPM access | |
run: npm whoami | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Build | |
run: pnpm build | |
- name: Get RC name | |
uses: frabert/replace-string-action@v2 | |
id: rc_name | |
with: | |
string: ${{ github.head_ref }} | |
pattern: "rc/" | |
replace-with: "rc-" | |
- name: Release to @${{ steps.rc_name.outputs.replaced }} tag on npm | |
id: release | |
run: | | |
echo "${{ steps.rc_name.outputs.replaced }}" | |
pnpm changeset:next | |
git add .changeset/fuel-labs-ci.md | |
pnpm changeset version --snapshot ${{ steps.rc_name.outputs.replaced }} | |
changetsets=$(pnpm changeset publish --tag ${{ steps.rc_name.outputs.replaced }}) | |
published_version=$(echo "$changetsets" | grep -oP '@\K([0-9]+\.){2}[0-9]+-${{ steps.rc_name.outputs.replaced }}-\d+' | head -1) | |
echo "published_version=$published_version" >> $GITHUB_OUTPUT | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add PR comment | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: | | |
RC published under the `${{ steps.rc_name.outputs.replaced }}` tag. | |
Install it: | |
```bash | |
pnpm add fuels@${{ steps.rc_name.outputs.replaced }} | |
pnpm add fuels@${{ steps.release.outputs.published_version }} | |
``` | |
Check it out: | |
- https://www.npmjs.com/package/fuels/v/${{ steps.rc_name.outputs.replaced }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |