From 1a7b0deb980049a3dd23302e048126e4b9360879 Mon Sep 17 00:00:00 2001 From: drumath2237 <2237k.drumath@gmail.com> Date: Fri, 5 Jul 2024 23:19:10 +0900 Subject: [PATCH] :green_heart: separate biuld and release process --- .github/workflows/ci.yml | 46 +++++++++++++++++++ .../{build_publish.yml => release.yml} | 39 ++++------------ 2 files changed, 56 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/ci.yml rename .github/workflows/{build_publish.yml => release.yml} (61%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..021c1b3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/build_publish.yml b/.github/workflows/release.yml similarity index 61% rename from .github/workflows/build_publish.yml rename to .github/workflows/release.yml index 0fb55ad..0ff3efe 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/release.yml @@ -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: