Merge remote-tracking branch 'upstream/main' #2
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: | |
paths: | |
- ".storybook/**" | |
- ".changeset/**" | |
- "packages/**" | |
- "stories/**" | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Check changed stories | |
id: stories | |
run: | | |
echo "changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q -e '^\.storybook/' -e '^stories/' && echo true || echo false)" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Install | |
uses: ./.github/composite-actions/install | |
- name: Build | |
run: pnpm build | |
- name: Create release PR or publish to NPM | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm release | |
commit: "ci(changesets): version packages" | |
setupGitUser: false | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create @dev release | |
if: steps.changesets.outputs.published != 'true' | |
run: | | |
git checkout main | |
pnpm version:dev | |
pnpm release:dev | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update docs | |
if: steps.changesets.outputs.published == 'true' | |
run: | | |
pnpm gen:docs | |
git add . | |
git diff --staged --exit-code || (git commit -m 'ci(docs): updated docs' && git push) | |
- name: Update changelog | |
if: steps.changesets.outputs.published == 'true' | |
run: | | |
pnpm changelog:latest | |
git add . | |
git diff --staged --exit-code || (git commit -m 'ci(changelog): added changelog' && git push) | |
- name: Notification Mattermost and Discord | |
if: steps.changesets.outputs.published == 'true' | |
run: | | |
pnpm notification:mattermost | |
pnpm notification:discord | |
env: | |
MATTERMOST_RELEASE_WEBHOOK_URL: ${{ secrets.MATTERMOST_RELEASE_WEBHOOK_URL }} | |
DISCORD_RELEASE_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }} | |
- name: Build Storybook | |
if: steps.stories.outputs.changed == 'true' || steps.changesets.outputs.published == 'true' | |
run: pnpm build:storybook | |
- name: Update Storybook | |
if: steps.stories.outputs.changed == 'true' || steps.changesets.outputs.published == 'true' | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: storybook-static | |
clean: true | |
clean-exclude: .nojekyll | |
- name: Release docs | |
if: steps.changesets.outputs.published == 'true' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.PAT_TOKEN }} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'hirotomoyamada', | |
repo: 'yamada-docs', | |
workflow_id: 'release.yml', | |
ref: 'main' | |
}) |