feat(styles): introduce AI Writing Assistant (#5578) #592
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: Create Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- tmp_hotfix_branch | |
env: | |
IS_HOTFIX: ${{ github.ref == 'refs/heads/tmp_hotfix_branch' }} | |
IS_PRERELEASE: ${{ github.event_name == 'push' && github.ref != 'refs/heads/tmp_hotfix_branch' }} | |
IS_MANUAL: ${{ contains(github.event.head_commit.message, 'chore(release)') }} | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} | |
NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} | |
jobs: | |
create_release: | |
name: Run release | |
runs-on: ubuntu-latest | |
outputs: | |
npmTag: ${{ steps.releaseTags.outputs.npm }} | |
ghTag: ${{ steps.releaseTags.outputs.gh }} | |
steps: | |
- name: Fetch from origin repo | |
uses: actions/[email protected] | |
with: | |
ref: ${{ fromJSON('["tmp_hotfix_branch", "main"]')[env.IS_HOTFIX] }} | |
fetch-depth: 0 | |
token: ${{ secrets.GHACTIONS }} | |
- uses: ./.github/actions/set-up-git | |
name: Set up git user | |
with: | |
name: ${{ secrets.GH_NAME }} | |
email: ${{ secrets.GH_EMAIL }} | |
- name: Setup Node.js and Cache | |
uses: ./.github/actions/nodejs | |
- name: Bump Version | |
id: bumpVersion | |
uses: ./.github/actions/bump-version | |
with: | |
isPrerelease: ${{ env.IS_PRERELEASE }} | |
isHotfix: ${{ env.IS_HOTFIX }} | |
- name: Get Release Tags | |
uses: ./.github/actions/release-tags | |
id: releaseTags | |
with: | |
bumpTag: ${{ steps.bumpVersion.outputs.releaseTag }} | |
bumpedVersion: ${{ steps.bumpVersion.outputs.newVersion }} | |
- name: Update using lerna # Skipping push, in case something goes wrong later during build/prepare | |
if: env.IS_MANUAL == 'false' | |
run: | | |
npx lerna version ${{ steps.bumpVersion.outputs.newVersion }} --yes --force-publish --message="chore(release): publish %v [ci skip]" --no-push | |
- run: yarn run lint | |
- run: yarn run build:prod | |
- name: Publish packages to NPM | |
uses: ./.github/actions/npm-publish | |
with: | |
packagePaths: 'dist/packages/styles,dist/packages/common-css,dist/packages/theming-preview,dist/packages/cx' | |
isPrerelease: ${{ steps.bumpVersion.outputs.isPrerelease }} | |
token: ${{ secrets.NPM_TOKEN }} | |
# This step is for pushing into the main repo if version has been updated by the CI. | |
# Commit is created by the lerna version command | |
# This Will NOT trigger this workflow again, so it is okay | |
- name: Push changes | |
if: env.IS_MANUAL == 'false' | |
run: git push --follow-tags | |
- name: Generate Release Body | |
id: generate_body | |
uses: ./.github/actions/generate-conventional-release-notes | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
prerelease: ${{ steps.bumpVersion.outputs.isPrerelease }} | |
tag: v${{ steps.bumpVersion.outputs.newVersion }} | |
body: ${{ steps.generate_body.outputs.generatedReleaseNotes }} | |
# This step is for pushing into the main only the version change, without anything else. | |
# This is useful when user created a Hotfix, and we need to sync the version on main | |
# if hotfix version is higher than latest stable and RC versions. | |
- name: Update version on main | |
if: env.IS_HOTFIX == 'true' && steps.releaseTags.outputs.mainNeedsSync == 'true' | |
run: | | |
git checkout -f main | |
npx lerna version ${{ steps.bumpVersion.outputs.newVersion }} --yes --force-publish --no-push --no-changelog --no-git-tag-version --no-changelog | |
git add . | |
git commit -m "chore(release): sync version after hotfix v${{ steps.bumpVersion.outputs.newVersion }} [ci skip]" | |
git push origin main | |
# This step is responsible for cleaning up the temporary hotfix branch | |
- name: Delete Temporary hotfix branch | |
if: env.IS_HOTFIX == 'true' | |
run: git push origin --delete tmp_hotfix_branch | |
gh_pages: | |
name: Github Pages deploy | |
runs-on: ubuntu-latest | |
needs: create_release | |
if: ${{ needs.create_release.outputs.npmTag == 'latest' }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
ref: main # always fetch from main branch | |
token: ${{ secrets.GHACTIONS }} | |
- name: Setup Node.js and Cache | |
uses: ./.github/actions/nodejs | |
- name: Run storybook:static build | |
run: npx cross-env STORYBOOK_BASE_HREF=fundamental-styles yarn run storybook:static | |
- name: Publish to gh-pages | |
uses: JamesIves/[email protected] | |
with: | |
folder: storybook-static | |
token: ${{ secrets.GHACTIONS }} | |
repository-name: ${{ github.repository }} |