Skip to content

Commit

Permalink
Merge pull request #36 from drumath2237/feature/#35-fix-release-build…
Browse files Browse the repository at this point in the history
…-process

fix release workflow
  • Loading branch information
drumath2237 authored Jul 5, 2024
2 parents cd9fafc + 1a7b0de commit 566c526
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 29 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build
on:
pull_request:

jobs:
lint_format:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install
- name: Static test
run: pnpm run check:ci

build:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
Original file line number Diff line number Diff line change
@@ -1,55 +1,36 @@
name: Build and Publish
name: Release
on:
pull_request:
branches: main
types:
- opened
- reopened
- synchronize
- closed

jobs:
build_and_test:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install
- name: Static test
run: pnpm run check:ci
- name: Build
run: pnpm run build

release:
runs-on: ubuntu-22.04
needs: build_and_test
permissions:
contents: read
id-token: write
# releaseブランチからmainにPRがマージされたら
if: |
github.event.pull_request.merged == true
&& github.base_ref == 'main'
&& startsWith(github.head_ref, 'release/v')
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
always-auth: true
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Publish
run: npm publish --provenance
env:
Expand Down

0 comments on commit 566c526

Please sign in to comment.