Merge pull request #351 from api3dao/main #145
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
# https://github.com/changesets/action | |
name: Release | |
on: | |
push: | |
branches: | |
- production | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_CONFIG_PROVENANCE: true | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
packages: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
fetch-depth: 0 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8.12.1 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build package | |
run: pnpm run 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=$(yarn changeset status --output=release.json > /dev/null && jq -r '.releases[0].newVersion' release.json && rm release.json)" >> "$GITHUB_ENV" | |
- name: Create Release | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm run release | |
commit: 'ci: release logos v${{ env.NEW_VERSION }}' | |
title: 'ci: release logos v${{ env.NEW_VERSION }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- 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' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |