Release 2024-08-27 11:49:30 +0900 #11
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: publish packages to npm registry | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [closed] | |
paths: | |
- 'packages/core/**' | |
- 'packages/v1/**' | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
permissions: | |
pull-requests: read | |
outputs: | |
core: ${{ steps.filter.outputs.core }} | |
v1: ${{ steps.filter.outputs.v1 }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
core: | |
- 'packages/core/**' | |
v1: | |
- 'packages/v1/**' | |
push-git-tag: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
timeout-minutes: 3 | |
outputs: | |
tag-name: ${{ 'v' }}${{ env.GIT_TAG_VERSION }} | |
tag-version: ${{ env.GIT_TAG_VERSION }} | |
tag-exists: ${{ steps.create-tag.outputs.tag_exists }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-dependencies | |
- name: get version from `package.json` | |
run: node -p -e '`GIT_TAG_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV | |
- uses: rickstaa/action-create-tag@v1 | |
id: create-tag | |
with: | |
tag: ${{ 'v' }}${{ env.GIT_TAG_VERSION }} | |
publish-release-note: | |
needs: push-git-tag | |
if: ${{ needs.push-git-tag.outputs.tag-exists == 'false' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
timeout-minutes: 5 | |
permissions: | |
contents: write | |
pull-requests: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: release-drafter/release-drafter@v6 | |
with: | |
name: ${{ needs.push-git-tag.outputs.tag-name }} | |
tag: ${{ needs.push-git-tag.outputs.tag-name }} | |
version: ${{ needs.push-git-tag.outputs.tag-version }} | |
publish: 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-core: | |
needs: [detect-changes, publish-release-note] | |
if: ${{ needs.detect-changes.outputs.core == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./packages/core | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-dependencies | |
- name: Build package | |
run: yarn run compile | |
- uses: ./.github/actions/publish-package | |
with: | |
working-directory: ./packages/core | |
node-auth-token: ${{ secrets.NPM_TOKEN }} | |
publish-v1: | |
needs: [detect-changes, publish-release-note] | |
if: ${{ needs.detect-changes.outputs.v1 == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./packages/v1 | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-dependencies | |
- name: Build package | |
run: yarn run compile | |
- uses: ./.github/actions/publish-package | |
with: | |
working-directory: ./packages/v1 | |
node-auth-token: ${{ secrets.NPM_TOKEN }} |