ci(changesets): version packages (#1176) #800
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: GitHub context | |
run: echo "$GITHUB_CONTEXT" | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
- name: Checkout | |
if: github.ref == 'refs/heads/main' | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 50 | |
- name: Fetch all tags (for releases) | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Install pnpm | |
uses: pnpm/[email protected] | |
with: | |
run_install: false | |
- name: Setup Node (uses version in .nvmrc) | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: pnpm | |
- name: Install dependencies | |
run: | | |
echo "pnpm version" | |
pnpm version | |
pnpm install | |
- name: Storing release version for changeset | |
id: release_version | |
run: ./scripts/echo-release-version.sh | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Ouptut release version | |
run: echo "The release version is ${{ steps.release_version.outputs.RELEASE_VERSION }}" | |
- name: Creating .npmrc | |
run: | | |
cat << EOF > "$HOME/.npmrc" | |
[email protected] | |
//registry.npmjs.org/:_authToken=$NPM_TOKEN | |
EOF | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Verify NPM user | |
run: pnpm auth | |
- name: Building packages | |
run: pnpm build | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: dotansimha/[email protected] | |
with: | |
title: 'ci(changesets): version packages' | |
commit: 'ci(changesets): version packages' | |
publish: pnpm changeset publish | |
version: pnpm changeset:version-and-format | |
createGithubReleases: aggregate | |
githubReleaseName: v${{ steps.release_version.outputs.RELEASE_VERSION }} | |
githubTagName: v${{ steps.release_version.outputs.RELEASE_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |