Skip to content

Commit

Permalink
chore: implement RC workflow (#1497)
Browse files Browse the repository at this point in the history
* Revert "feat: add `Predicate.getTransferTxId` helper (#1467)"

This reverts commit 70233c1.

* chore: add rc workflow

* chore: changeset

* chore: change rc workflow name

* chore: fix rc version

* chore: remove workflow dispatch for rc worjflow

* chore: add correct rc naming

* chore: use correct branch filtering

* chore: linting

* chore: alter branch name env

* chore: change pull request to push

* feat: set correct rc versiuon in worflow

* feat: add echo rc verison

* chore: test ci

* chore: test ci

* chore: echo changesets

* chore: use env in rc changeset

* test dan release

* chore: enable pr release

* chore: copy pr relase

* try rc nam,e

* use salamander

* chore: use rc name

* use: salamander

* chore: test salamander

* chore: fix workflow trigger

* chore: remove env rc name

* chore: update rc suffix

---------

Co-authored-by: Anderson Arboleya <anderson@arboleya.me>
  • Loading branch information
danielbate and arboleya committed Dec 15, 2023
1 parent cd7aed5 commit 5261579
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .changeset/flat-dodos-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
58 changes: 58 additions & 0 deletions .github/workflows/rc-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release to @rc-<name> tag on npm

on:
push:
branches:
- "rc/*"

jobs:
release-pr:
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.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 }}

- uses: mshick/add-pr-comment@v2
with:
message: |
This RC is published in NPM with version **${{ steps.rc_name.outputs.replaced }}**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5261579

Please sign in to comment.