feat: add base asset deploy script (#322) #131
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 packages to npm' | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release-changesets: | |
name: Changesets Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# need this to get full git-history/clone in order to build changelogs and check changesets | |
fetch-depth: 0 | |
- uses: FuelLabs/github-actions/setups/node@master | |
with: | |
node-version: 20.16.0 | |
pnpm-version: 9.0.6 | |
- uses: FuelLabs/github-actions/setups/npm@master | |
with: | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
- uses: ./.github/actions/setup-rust | |
- name: Bump and Collect Version | |
run: | | |
pnpm changeset version | |
echo "BUILD_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' packages/solidity-contracts/package.json)" >> $GITHUB_ENV | |
git reset --hard | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup git user (for changelog step) | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Build | |
run: pnpm build | |
- name: Create Release Pull Request or Publish to NPM | |
id: changesets | |
uses: FuelLabs/changesets-action@main | |
with: | |
publish: pnpm changeset:release | |
commit: 'ci(changesets): versioning packages' | |
title: 'ci(changesets): versioning packages' | |
createGithubReleases: aggregate | |
githubReleaseName: v${{ env.BUILD_VERSION }} | |
githubTagName: v${{ env.BUILD_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Release to @next tag | |
if: steps.changesets.outputs.published != 'true' | |
run: | | |
git checkout main | |
pnpm changeset version --snapshot next | |
pnpm changeset publish --tag next | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |