From 9a7cfad3ea95ae9c56e88f63231da7a3a8b05c40 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:03:12 +0000 Subject: [PATCH] fix: resolve issues with automated releases (#1974) * chore: don't npm publish unwanted files * fix: download car artifact * fix: Only release on manual ci.yml workflow dispatch --- .github/workflows/ci.yml | 20 +++++++++++++++++--- package.json | 29 +++++++++++++++++------------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c6d4bcca..ba05ffc69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,12 +81,12 @@ jobs: - run: echo ${{ github.ref }} - name: Create ipfs-webui.car file run: | - ipfs dag export ${{ steps.ipfs.outputs.cid }} > build/ipfs-webui_${{ github.sha }}.car + ipfs dag export ${{ steps.ipfs.outputs.cid }} > ipfs-webui_${{ github.sha }}.car - name: Attach produced build to Github Action uses: actions/upload-artifact@v2 with: name: ipfs-webui_${{ github.sha }}.car - path: build/ipfs-webui_${{ github.sha }}.car + path: ipfs-webui_${{ github.sha }}.car if-no-files-found: error - name: Pin to estuary.tech @@ -170,7 +170,6 @@ jobs: # 2. The 'publish-release-build.yml' workflow release: name: 'Run semantic release' - if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest needs: [build, publishPreview, eslint, typecheck, test-e2e, test-unit] steps: @@ -214,8 +213,23 @@ jobs: - name: Install dependencies run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm + - name: Download CAR artifact + uses: actions/download-artifact@v3 + with: + name: ipfs-webui_${{ github.sha }}.car + + - name: Dry-run semantic release + if: github.ref != 'refs/heads/main' + run: | + git config user.name "ipfs-gui-bot" + git config user.email "108953096+ipfs-gui-bot@users.noreply.github.com" + npx semantic-release --ci --dry-run -b ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + # Update the version (npm version [major|minor|patch]) - name: Run semantic release + if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' run: | git config user.name "ipfs-gui-bot" git config user.email "108953096+ipfs-gui-bot@users.noreply.github.com" diff --git a/package.json b/package.json index a39fa85c5..725e1ae5d 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,14 @@ "name": "ipfs-webui", "version": "2.17.3", "private": true, + "files": [ + "src", + "public", + "@types", + "ipfs-core-types", + "docs", + "build" + ], "scripts": { "start": "run-script-os", "start:win32": "@powershell -Command $env:REACT_APP_GIT_REV=(git rev-parse --short HEAD); react-scripts start", @@ -272,18 +280,15 @@ "tarballDir": "dist" } ], - [ - "@semantic-release/github", - { - "assets": [ - { - "path": "build/ipfs-webui_*.car", - "name": "ipfs-webui@${nextRelease.gitTag}.car", - "label": "IPFS webui (${nextRelease.gitTag}) CAR file" - } - ] - } - ], + ["@semantic-release/github", { + "assets": [ + { + "path": "ipfs-webui_*.car", + "name": "ipfs-webui@${nextRelease.gitTag}.car", + "label": "IPFS webui (${nextRelease.gitTag}) CAR file" + } + ] + }], "@semantic-release/git" ] },