From d49b9c7c5e7ec834e9057a2ece73ffea0a7f19f7 Mon Sep 17 00:00:00 2001 From: selankon Date: Fri, 9 Feb 2024 17:40:01 +0100 Subject: [PATCH 1/8] chore(gh-action): add gh action to upload artifacts --- .github/workflows/development.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index d086bf84..7afce4a5 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -17,3 +17,9 @@ jobs: - uses: preactjs/compressed-size-action@v2 with: build-script: "build:production" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: build/ From 6bcf6986541e5867948ceb165e7632c75fbd1e40 Mon Sep 17 00:00:00 2001 From: selankon Date: Fri, 9 Feb 2024 18:09:21 +0100 Subject: [PATCH 2/8] chore(gh-action): specific action to publish artifacts --- .github/workflows/development.yml | 6 --- .github/workflows/publish_artifacts.yml | 54 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/publish_artifacts.yml diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 7afce4a5..d086bf84 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -17,9 +17,3 @@ jobs: - uses: preactjs/compressed-size-action@v2 with: build-script: "build:production" - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: build-artifacts - path: build/ diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml new file mode 100644 index 00000000..a9b3102d --- /dev/null +++ b/.github/workflows/publish_artifacts.yml @@ -0,0 +1,54 @@ +name: CI-Development + +on: + pull_request: + types: + - labeled + +jobs: + build-artifacts: + if: contains(github.event.pull_request.labels.*.name, 'artifact') + runs-on: ubuntu-latest + + steps: + - name: Find a PR comment + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + body-includes: 'Artifacts deployed: ' + - name: Delete Comment + uses: actions/github-script@v6 + continue-on-error: true + if: steps.fc.outputs.comment-id != 0 + with: + script: | + github.rest.issues.deleteComment({ + comment_id: ${{ steps.fc.outputs.comment-id }}, + owner: context.repo.owner, + repo: context.repo.repo, + }) + + - uses: actions/checkout@v3 + + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: preactjs/compressed-size-action@v2 + with: + build-script: "build:production" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: build/ + + - name: Update the PR comment + uses: peter-evans/create-or-update-comment@v2 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Artifacts deployed: ${{ steps.artifact-upload-step.outputs.artifact-url }} From 731f8efda0f2dbbcdcf4ff6f74e71c49ebaa6807 Mon Sep 17 00:00:00 2001 From: selankon Date: Fri, 9 Feb 2024 18:27:06 +0100 Subject: [PATCH 3/8] chore(gh-action): change actions names --- .github/workflows/development.yml | 2 +- .github/workflows/publish_artifacts.yml | 2 +- .github/workflows/tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index d086bf84..a5aaf9d6 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -1,4 +1,4 @@ -name: CI-Development +name: Test build on: [pull_request] diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index a9b3102d..388624f8 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -1,4 +1,4 @@ -name: CI-Development +name: Publish artifacts on: pull_request: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dcecf326..aaa0ec3e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: Node.js CI +name: Run tests on: push: From bcaa1211985681bce3423952edbfb8287fc6c887 Mon Sep 17 00:00:00 2001 From: selankon Date: Fri, 9 Feb 2024 18:27:30 +0100 Subject: [PATCH 4/8] chore(gh-action): disable pr comments --- .github/workflows/publish_artifacts.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index 388624f8..eab750b5 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -11,24 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Find a PR comment - uses: peter-evans/find-comment@v2 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - body-includes: 'Artifacts deployed: ' - - name: Delete Comment - uses: actions/github-script@v6 - continue-on-error: true - if: steps.fc.outputs.comment-id != 0 - with: - script: | - github.rest.issues.deleteComment({ - comment_id: ${{ steps.fc.outputs.comment-id }}, - owner: context.repo.owner, - repo: context.repo.repo, - }) - - uses: actions/checkout@v3 - name: Install node @@ -45,10 +27,3 @@ jobs: with: name: build-artifacts path: build/ - - - name: Update the PR comment - uses: peter-evans/create-or-update-comment@v2 - with: - issue-number: ${{ github.event.pull_request.number }} - body: | - Artifacts deployed: ${{ steps.artifact-upload-step.outputs.artifact-url }} From eb6f1cd62c36bd498aa1ced8b074c664268796b8 Mon Sep 17 00:00:00 2001 From: selankon Date: Fri, 9 Feb 2024 18:55:21 +0100 Subject: [PATCH 5/8] chore(gh-action): fix the action --- .github/workflows/publish_artifacts.yml | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index eab750b5..6d4c5471 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -2,28 +2,27 @@ name: Publish artifacts on: pull_request: - types: - - labeled + types: [ labeled ] jobs: - build-artifacts: - if: contains(github.event.pull_request.labels.*.name, 'artifact') - runs-on: ubuntu-latest + build-artifacts: + if: ${{ github.event.label.name == 'artifact' }} + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + steps: + - uses: actions/checkout@v3 - - name: Install node - uses: actions/setup-node@v3 - with: + - name: Install node + uses: actions/setup-node@v3 + with: node-version: 16 - - uses: preactjs/compressed-size-action@v2 - with: - build-script: "build:production" + - uses: preactjs/compressed-size-action@v2 + with: + build-script: "build:production" - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: name: build-artifacts path: build/ From c3e0ec52542083992f690cdf74f7bdaafa9eeac9 Mon Sep 17 00:00:00 2001 From: selankon Date: Mon, 12 Feb 2024 16:24:00 +0100 Subject: [PATCH 6/8] chore(gh-action): fix publish artifacts --- .github/workflows/publish_artifacts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index 6d4c5471..2bd627a8 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -2,11 +2,11 @@ name: Publish artifacts on: pull_request: - types: [ labeled ] + types: [ labeled, synchronize ] jobs: build-artifacts: - if: ${{ github.event.label.name == 'artifact' }} + if: contains(github.event.pull_request.labels.*.name, 'artifact') runs-on: ubuntu-latest steps: From b3357190b048a8018e691123b402499ab8c613db Mon Sep 17 00:00:00 2001 From: selankon Date: Mon, 12 Feb 2024 17:40:16 +0100 Subject: [PATCH 7/8] chore(gh-action): publish dynamic artifact name --- .github/workflows/publish_artifacts.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index 2bd627a8..94d77171 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -21,8 +21,13 @@ jobs: with: build-script: "build:production" + # Used to send a comment to the PR with the artifact url + - name: Save PR number + run: | + echo ${{ github.event.number }} > ./build/NR + - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: build-artifacts + name: limeAppBuild-${{ github.event.number }} path: build/ From cc4773f0025dda915aaf1ac2873c53442175b486 Mon Sep 17 00:00:00 2001 From: selankon Date: Mon, 12 Feb 2024 18:54:55 +0100 Subject: [PATCH 8/8] chore(gh-action): Fix save pr number --- .github/workflows/publish_artifacts.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_artifacts.yml b/.github/workflows/publish_artifacts.yml index 94d77171..0f137992 100644 --- a/.github/workflows/publish_artifacts.yml +++ b/.github/workflows/publish_artifacts.yml @@ -24,10 +24,11 @@ jobs: # Used to send a comment to the PR with the artifact url - name: Save PR number run: | - echo ${{ github.event.number }} > ./build/NR + mkdir -p build/pr_number/ + touch build/pr_number/${{ github.event.number }} - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: limeAppBuild-${{ github.event.number }} + name: limeAppBuild path: build/