From 21b749c98b48133fc46b23e03b19ba5d6d21a38d Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 13 Jun 2024 19:31:59 +1000 Subject: [PATCH] chore(ci): bump action versions, python for macosx, fix codecov (#83) * chore(ci): bump action versions * chore: does adding python action do anything * chore: bump more versions * fix: new upload/download patterns * fix: codecov has needed token for last few months * chore: attempt to swap to wrangler * fix: wrangler expects a directory to be specified * fix: missed storybook url * chore: update preview url comment in place * chore: update formatting of preview message * fix: comment_tag parametter, not part of message! * chore: try a different comment updater --- .github/workflows/pipeline.yml | 68 +++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 434b2c4..0186728 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -74,7 +74,9 @@ jobs: CI: true - name: Publish Coverage - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} test-types: runs-on: ubuntu-latest @@ -121,7 +123,7 @@ jobs: run: yarn build:storybook - name: Store storybook - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: storybook-static retention-days: 1 @@ -145,6 +147,11 @@ jobs: node-version: "20" cache: "yarn" + - name: Setup Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Install required python deps run: python3 -m pip install setuptools @@ -165,7 +172,7 @@ jobs: GITHUB_PR_BUILDS_KEY: ${{ secrets.PR_BUILDS_TOKEN }} - name: Store compiled source - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: compiled-${{ matrix.os }} retention-days: 1 @@ -201,7 +208,7 @@ jobs: run: yarn --immutable - name: Fetch compiled source - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: compiled-${{ matrix.os }} path: build @@ -210,9 +217,9 @@ jobs: run: yarn run pack - name: Upload build - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: app-builds + name: app-builds-${{ matrix.os }} retention-days: 15 if-no-files-found: error path: | @@ -240,14 +247,14 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload test results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: electron-${{ matrix.os }}-test-results path: playwright-report - name: Upload video recordings - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: electron-${{ matrix.os }}-recordings @@ -295,7 +302,7 @@ jobs: run: yarn playwright install --with-deps - name: Fetch compiled source - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: compiled-ubuntu-20.04 path: build @@ -307,7 +314,7 @@ jobs: PWTEST_VIDEO: "true" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: video-web-linux-test-results @@ -319,35 +326,43 @@ jobs: runs-on: ubuntu-latest steps: - name: Fetch compiled source - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: compiled-ubuntu-20.04 path: build - name: Fetch storybook build - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: storybook-static path: build/renderer/storybook - - name: Preview + - name: Deploy preview id: cloudflare-preview - uses: cloudflare/pages-action@1 + uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: buddy - directory: build/renderer - gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.head_ref || github.ref_name }} + command: pages deploy build/renderer --project-name=buddy + + - name: Find preview comment if present + uses: peter-evans/find-comment@v3 + id: find-preview-comment + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Buddy has been automatically deployed to Cloudflare - - name: Comment preview URL - uses: thollander/actions-comment-pull-request@v2 + - name: Create or update preview URL comment + uses: peter-evans/create-or-update-comment@v4 with: - message: | + comment-id: ${{ steps.find-preview-comment.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | EdgeTX Buddy has been automatically deployed to Cloudflare. - ✅ Preview: ${{ steps.cloudflare-preview.outputs.url }} - ✅ Storybook: ${{ steps.cloudflare-preview.outputs.url }}/storybook + ✅ Preview: ${{ steps.cloudflare-preview.outputs.deployment-url }} + ✅ Storybook: ${{ steps.cloudflare-preview.outputs.deployment-url }}/storybook + edit-mode: replace release-web-prod: needs: [e2e-web, test, storybook] @@ -355,7 +370,7 @@ jobs: if: github.event_name != 'pull_request' steps: - name: Fetch compiled source - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: compiled-ubuntu-20.04 path: build @@ -375,10 +390,11 @@ jobs: if: github.event_name != 'pull_request' steps: - name: Fetch binaries - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: app-builds + pattern: app-builds-* path: app-builds + merge-multiple: true - name: Release latest build if: startsWith(github.ref, 'refs/tags/v') != true