Skip to content

Merge pull request #441 from api3dao/changeset-release/production #94

Merge pull request #441 from api3dao/changeset-release/production

Merge pull request #441 from api3dao/changeset-release/production #94

Workflow file for this run

#also has a specific scope https://github.com/changesets/action
########################################################################################
# The following secrets are required:
#
# 1. NPM_TOKEN - A "fine-grained personal access token" generated through the
# npmjs.com UI. Tokens are generated at the user level, rather than organisation
# level. Each token is also scoped to the specific package.
#
# The following minimum permissions are required:
# Read & write - access to package & scope
#
# 2. GITHUB_TOKEN - automatically provided by Github to workflow runs.
########################################################################################
name: Release
on:
push:
branches:
- production
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write
pull-requests: write
steps:
- name: Clone @api3/chains
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build package
run: pnpm build
- name: Ensure main is present for commit message prep
run: |
git checkout main
git checkout production
- name: Prep commit message
run: |
echo "NEW_VERSION=$(pnpm changeset status --output=release.json > /dev/null && jq -r '.releases[0].newVersion' release.json && rm release.json)" >> "$GITHUB_ENV"
- name: Check release
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
commit: 'ci: release chains v${{ env.NEW_VERSION }}'
title: 'ci: release chains v${{ env.NEW_VERSION }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
- name: Create pull request
if: steps.changesets.outputs.published == 'true'
run: gh pr create -B main -H production --title 'Merge production into main' --body 'Merges production into main' --reviewer andreogle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}