ci(changesets): versioning packages (#139) #41
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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release-changesets: | |
name: Changesets Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# need this to get full git-history/clone in order to build changelogs and check changesets | |
fetch-depth: 0 | |
- uses: FuelLabs/github-actions/setups/node@master | |
with: | |
pnpm-version: 9.5.0 | |
- uses: FuelLabs/github-actions/setups/npm@master | |
with: | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
- name: Bump and Collect Version | |
run: | | |
pnpm changeset version | |
echo "BUILD_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' packages/jest/package.json)" >> $GITHUB_ENV | |
git reset --hard | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup git user (for changelog step) | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Build | |
run: pnpm build | |
- name: Create Release Pull Request or Publish to NPM | |
id: changesets | |
uses: FuelLabs/changesets-action@v3.0.0 | |
with: | |
publish: pnpm changeset publish --tag next --no-git-tag | |
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.REPO_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Release to @main tag | |
if: steps.changesets.outputs.published != 'true' | |
run: | | |
git checkout main | |
pnpm changeset version --snapshot main | |
pnpm changeset publish --tag main | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: ZIP Proxy Action CLI | |
run: | | |
zip -j -r ./proxy-actions.zip ./packages/proxy-actions/dist | |
- name: Upload Proxy Action CLI to Release | |
if: steps.changesets.outputs.published == 'true' | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: v${{ env.BUILD_VERSION }} | |
files: | | |
./proxy-actions.zip |