chore: bump version to 0.0.42 #280
This file contains hidden or 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: Deployment | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
check-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.filter.outputs.changed }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Check for changes in .ts and .tsx files | |
id: filter | |
uses: dorny/paths-filter@v3 | |
with: | |
filters: | | |
changed: | |
- 'src/**/*.ts' | |
- 'src/**/*.tsx' | |
- 'tsup.config.ts' | |
deploy: | |
runs-on: ubuntu-latest | |
needs: check-changes | |
if: ${{ needs.check-changes.outputs.changed == 'true' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.TOSS_REACTIVE_KIT_GITHUB_ACCESS_TOKEN }} | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Bump version | |
run: yarn version patch | |
- name: Publish package | |
run: | | |
echo "npmAuthToken: \${NPM_TOKEN}" >> .yarnrc.yml | |
yarn npm publish | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_OPTIONS: --max-old-space-size=8192 | |
- name: Set git username with email | |
run: | | |
git config user.name "seungrodotlee" | |
git config user.email "[email protected]" | |
- name: Tag version | |
run: | | |
VERSION=$(jq -r '.version' package.json) | |
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
git tag -a "v$VERSION" -m "$COMMIT_MESSAGE" | |
- name: Commit version bump | |
run: | | |
VERSION=$(jq -r '.version' package.json) | |
git add package.json | |
git commit -m "chore: bump version to $VERSION" | |
- name: Push changes and tags | |
run: | | |
git push -u origin HEAD --follow-tags --force | |
get-diffs: | |
runs-on: ubuntu-latest | |
needs: check-changes | |
if: ${{ needs.check-changes.outputs.changed == 'true' }} | |
outputs: | |
result: ${{ steps.diffs.outputs.result }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files from merged PR | |
id: diffs | |
run: | | |
MATCHED_NAMES=$(git diff-tree --no-commit-id --name-only -r HEAD | grep -E '^src/[^/]+/([^/]+)/\1\.tsx?$' | sed -r "s/.+\/(.+)\..+/\1/" | tr "\n" "," | sed 's/,$//') | |
echo $MATCHED_NAMES | |
echo "result=$MATCHED_NAMES" >> "$GITHUB_OUTPUT" | |
generate-docs: | |
runs-on: ubuntu-latest | |
needs: get-diffs | |
if: ${{ needs.get-diffs.outputs.result != '' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Generate docs | |
run: | | |
yarn run docs:gen ${{ needs.get-diffs.outputs.result }} | |
yarn run fix:format | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: new-docgen-branch-${{ github.run_id }} | |
title: 'docs(${{ needs.get-diffs.outputs.result }}): auto-generated docs' | |
body: 'This PR includes documentation updates for: ${{ needs.get-diffs.outputs.result }}' | |
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
reviewers: seungrodotlee,pumpkiinbell,choi2021 | |
commit-message: 'Generate docs for ${{ needs.get-diffs.outputs.result }}' |