From 88d5298b06815c066c192bb06b206870acf1b0d1 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:22:21 -0700 Subject: [PATCH] fix: release-please release creation (#2683) --- .github/workflows/ci.yml | 23 ++++++++++++++--------- package.json | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f721a69cb..ed2e3a41e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -201,14 +201,6 @@ jobs: shell: bash continue-on-error: true # empty steps.tag.outputs.tag will inform the next step - # This step will only handle the creation of the release draft, the "Build binaries with electron-builder" step - # will attach binaries to that release draft - - name: Run release-please github-release # see https://github.com/google-github-actions/release-please-action/issues/841 - if: contains(github.ref, 'refs/tags/') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') - run: npm run release-gh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build binaries with electron-builder uses: paneron/action-electron-builder@14b133702d1b2e9749912051c43ed62b4afe56c8 # v1.8.1 with: @@ -252,7 +244,8 @@ jobs: run: du -sh ${{ github.workspace }}/.cache/ && ls -l ${{ github.workspace }}/.cache/ # This Job will handle the creation of the "release-please" PR - create-release-please-pr: + release-please-pr: + name: "Create release-please PR or GitHub Release" runs-on: ubuntu-latest needs: [test, build] if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') @@ -268,7 +261,19 @@ jobs: - name: Install dependencies run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm + # This step creates a release-please PR if there are any commits that haven't been released yet. - name: Run release-please release-pr # see https://github.com/google-github-actions/release-please-action/issues/841 + id: release-please-release-pr run: npm run release-pr env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true # release-please release-pr will fail when a release-please PR was merged and the tag doesn't exist. + + # This step will only handle the creation of the release draft, the "Build binaries with electron-builder" step + # will attach binaries to that release draft + - name: Run release-please github-release # see https://github.com/google-github-actions/release-please-action/issues/841 + # if npm run release-pr fails, then we want to run release-please github-release + if: steps.release-please-release-pr.outcome == 'failure' + run: npm run release-gh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 805c91883..f629e82f2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "build:webui:minimize": "shx rm -rf assets/webui/static/js/*.map && shx rm -rf assets/webui/static/css/*.map", "package": "shx rm -rf dist/ && run-s build && electron-builder --publish onTag", "release-pr": "release-please release-pr --token=$GITHUB_TOKEN --plugin '@ipfs-shipyard/release-please-ipfs-plugin' --repo-url=ipfs/ipfs-desktop --trace --debug --draft-pull-request", - "release-gh": "release-please github-release --token=$GITHUB_TOKEN --repo-url=ipfs/ipfs-desktop --trace --debug --draft" + "release-gh": "release-please github-release --token=$GITHUB_TOKEN --plugin '@ipfs-shipyard/release-please-ipfs-plugin' --repo-url=ipfs/ipfs-desktop --trace --debug --draft" }, "pre-commit": [ "lint"