From ff8457b87e86fe8c56e62f1e1874238fe0a07b0d Mon Sep 17 00:00:00 2001 From: kawamataryo Date: Tue, 22 Aug 2023 21:44:18 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix=20ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 989aa67..c65087f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,7 @@ on: - main jobs: - build: + check-release-requirement: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -27,15 +27,37 @@ jobs: run: npm ci - name: Check if release is required - run: ls .changeset/*.md > /dev/null 2>&1 || exit 1 + run: ls .changeset/*.md > /dev/null 2>&1 && echo "release-required" || echo "no-release-required" + id: check_release continue-on-error: true - - name: If there is no need to release - if: ${{ failure() }} - run: echo "No need to release" + outputs: + release: ${{ steps.check_release.outputs.result }} + + build-and-publish: + needs: check-release-requirement + if: needs.check-release-requirement.outputs.release == 'release-required' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: '18' + check-latest: true + + - name: Cache npm dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + run: npm ci - name: Update version - if: ${{ success() }} run: npx changeset version - name: Build the extension