Skip to content

fix: type declarations for @fuel-ts/account/test-utils #4318

fix: type declarations for @fuel-ts/account/test-utils

fix: type declarations for @fuel-ts/account/test-utils #4318

name: Release to @rc-<pr_number> tag on npm
on:
pull_request:
branches:
- "master"
types:
- opened
- edited
- synchronize
- ready_for_review
- converted_to_draft
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
check-pr:
runs-on: ubuntu-latest
name: "Validate if PR needs to be released"
outputs:
isBreakingChange: ${{ steps.check-title.outputs.isBreakingChange }}
isDraft: ${{ steps.check-draft.outputs.isDraft }}
steps:
- name: Check if PR title is a breaking change
id: check-title
run: |
PR_TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH")
echo "$PR_TITLE"
if echo "$PR_TITLE" | grep -qE '^\w+!:'; then
echo "isBreakingChange=true" >> "$GITHUB_OUTPUT"
else
echo "isBreakingChange=false" >> "$GITHUB_OUTPUT"
fi
- name: Check if PR is a draft
id: check-draft
run: |
if ${{ github.event.pull_request.draft }}; then
echo "isDraft=true" >> "$GITHUB_OUTPUT"
else
echo "isDraft=false" >> "$GITHUB_OUTPUT"
fi
release-pr:
needs: check-pr
if: needs.check-pr.outputs.isBreakingChange == 'true' && needs.check-pr.outputs.isDraft == 'false'
name: "Release breaking change PR to npm"
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/ci-setup
with:
node-version: 20.10.0
pnpm-version: 9.0.5
- uses: FuelLabs/github-actions/setups/npm@master
with:
npm-token: ${{ secrets.NPM_TOKEN }}
- name: Build
run: pnpm build
- name: Add RC flag to PR name
uses: frabert/replace-string-action@v2
id: release_name
with:
string: ${{ github.event.pull_request.number }}
pattern: "^(.*)$"
replace-with: "rc-$1"
- name: Release to @${{ steps.release_name.outputs.replaced }} tag on npm
id: release
run: |
pnpm changeset:next
git add .changeset/fuel-labs-ci.md
pnpm changeset version --snapshot ${{ steps.release_name.outputs.replaced }}
changetsets=$(pnpm changeset publish --tag ${{ steps.release_name.outputs.replaced }})
published_version=$(echo "$changetsets" | grep -oP '@\K([0-9]+\.){2}[0-9]+-${{ steps.release_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: Update SDK on Wallet
uses: benc-uk/workflow-dispatch@v1
with:
workflow: update-sdk-manual.yaml
ref: master
repo: FuelLabs/fuels-wallet
inputs: '{ "publisher": "${{ github.event.repository.name }}", "issue": "${{ github.event.pull_request.number }}", "packages": "fuels", "tag": "${{ steps.release_name.outputs.replaced }}" }'
token: ${{ secrets.REPO_TOKEN }}