Skip to content

fix: cross-fetch version (#1113) #413

fix: cross-fetch version (#1113)

fix: cross-fetch version (#1113) #413

Workflow file for this run

name: "Release"
on:
push:
branches:
- master
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: "Release"
runs-on: ubuntu-latest
permissions: write-all
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
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
# if there are changesets present, package.json will be bumped
- name: Bump and Collect Versions
run: |
pnpm changeset version
echo "BUILD_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' packages/fuels/package.json)" >> $GITHUB_ENV
echo "FUEL_CORE_VERSION=$(cat ./packages/fuel-core/VERSION)" >> $GITHUB_ENV
echo "FORC_VERSION=$(cat ./packages/forc/VERSION)" >> $GITHUB_ENV
git reset --hard
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure NPM access
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- 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:publish
version: pnpm changeset:version-with-docs
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 }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release to @next tag on npm
if: steps.changesets.outputs.published != 'true'
run: |
git checkout master
pnpm changeset:next
git add .changeset/fuel-labs-ci.md
pnpm changeset version --snapshot next
pnpm changeset publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ensure docs are always deployed after merge of changeset PR
- name: Get the last commit message and set env vars
run: echo LAST_COMMIT_MSG=$(git --no-pager log -1 --pretty=%B) >> $GITHUB_ENV
- name: Decides if Docs should be deployed
if: startsWith(env.LAST_COMMIT_MSG, 'ci(changesets):')
run: echo SHOULD_DEPLOY_DOCS=true >> $GITHUB_ENV
- name: Configure GitHub Pages
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/configure-pages@v2
- name: Upload Docs Artifact
if: env.SHOULD_DEPLOY_DOCS == 'true'
uses: actions/upload-pages-artifact@v1
with:
path: apps/docs/dist
- name: Deploy Docs
if: env.SHOULD_DEPLOY_DOCS == 'true'
id: deployment
uses: actions/deploy-pages@v1