Skip to content

Merge pull request #293 from reown-com/develop #35

Merge pull request #293 from reown-com/develop

Merge pull request #293 from reown-com/develop #35

Workflow file for this run

name: Release
on:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
name: Release
permissions:
contents: write
id-token: write
pull-requests: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name:
uses: ./.github/actions/setup
- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
title: 'chore: version packages'
commit: 'chore: version packages'
publish: yarn run changeset:publish
version: yarn run changeset:version
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Github Release
if: steps.changesets.outputs.published == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(node -pe "require('./package.json').version")
gh release create "v$VERSION" --generate-notes --target main
- name: Publish NPM pre-release
if: steps.changesets.outputs.published != 'true'
continue-on-error: true
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
git reset --hard origin/main
yarn run changeset version --no-git-tag --snapshot canary
yarn run changeset:prepublish
yarn run changeset publish --no-git-tag --snapshot canary --tag canary
- name: Get NPM Version
if: steps.changesets.outputs.published != 'true'
id: get_version
run: |
VERSION=$(node -pe "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Comment Version on Pull Request
if: steps.changesets.outputs.published != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=$(gh pr list --state open --author ${{ github.actor }} --json number --jq '.[0].number')
gh pr comment $PR_NUMBER --body "Published pre-release version: ${{ env.VERSION }}"