Merge pull request #26 from darioegb/changeset-release/main #87
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: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install | |
uses: ./.github/composite-actions/common | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: pnpm run version-packages | |
commit: 'ci(changesets): version packages' | |
publish: pnpm release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Update changelog | |
if: steps.changesets.outputs.published == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
if ! git ls-remote --exit-code --h origin changelog/main; then | |
git checkout main | |
git checkout -b changelog/main | |
git push origin changelog/main | |
else | |
git checkout changelog/main | |
git pull origin main | |
fi | |
pnpm changelog | |
pnpm changelog:commit | |
gh pr create --base main --head changelog/main --title "Update Root Changelog" --body "This pull request updates the Main Changelog of the monorepo." | |
- name: Generate docs | |
id: run-build-docs | |
if: steps.changesets.outputs.published == 'true' | |
run: pnpm build:docs | |
- name: Publish Storybook to Chromatic | |
if: steps.changesets.outputs.published == 'true' | |
uses: chromaui/action@v1 | |
with: | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
storybookBuildDir: 'storybook-static' | |
workingDir: 'apps/docs' | |
zip: true | |
exitOnceUploaded: true |