再利用ワークフローによるワークフローの使い分け #40
Workflow file for this run
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 | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
check: | |
if: github.event.pull_request.merged == true | |
uses: whyk-pg/learn-jsr/.github/workflows/reuse_check.yml@main | |
publish: | |
runs-on: ubuntu-latest | |
needs: [check] | |
permissions: | |
contents: write | |
id-token: write # The OIDC ID token is used for authentication with JSR. | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Get new git tag | |
id: tag_version_dry_run | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
dry_run: true | |
release_branches: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup JSR version | |
run: | | |
git config --local user.name "WhyK" | |
git config --local user.email "${{ secrets.USER_EMAIL }}" | |
deno task update ${{ steps.tag_version_dry_run.outputs.new_tag }} | |
git add deno.json | |
git commit -m "chore: update version to ${{ steps.tag_version_dry_run.outputs.new_tag }}" | |
git push | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
release_branches: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
- name: Publish JSR | |
run: | | |
deno publish |