From 8d4701c69c88a5b2cc29ec2662cb551b79713967 Mon Sep 17 00:00:00 2001 From: toino Date: Sat, 23 Sep 2023 16:22:48 +0100 Subject: [PATCH 1/5] Start implementing cd --- .github/workflows/cd.yml | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..9cf1213 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,94 @@ +name: CD + +on: + release: + types: ["published"] + pull_request: + branches: [main, develop] + +jobs: + build: + name: Build + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "20" + cache: "yarn" + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Build + run: yarn release + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + path: bundle + name: bundle + + chrome: + name: Deploy to Chrome + runs-on: ubuntu-latest + needs: build + env: + EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} + CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} + REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: bundle + - run: ls -R + # - name: Upload to Chrome Web Store + # working-directory: bundle/chrome + # run: npx chrome-webstore-upload-cli upload --auto-publish + + edge: + name: Deploy to Edge + runs-on: ubuntu-latest + needs: build + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: bundle + + firefox: + name: Deploy to Firefox + runs-on: ubuntu-latest + needs: build + env: + API_KEY: ${{ secrets.FIREFOX_API_KEY }} + API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: bundle + # - name: Sign add-on + # working-directory: bundle/firefox + # run: npx web-ext sign --api-key $API_KEY --api-secret $API_SECRET + + opera: + name: Deploy to Opera + runs-on: ubuntu-latest + needs: build + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: bundle + + safari: + name: Deploy to Safari + runs-on: macos-latest + needs: build + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: bundle From 04b469751ee339affe77ceec91f7cf25ceeb481e Mon Sep 17 00:00:00 2001 From: toino Date: Sat, 23 Sep 2023 17:25:03 +0100 Subject: [PATCH 2/5] Use multiple artifacts --- .github/workflows/cd.yml | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9cf1213..523447d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,11 +22,21 @@ jobs: run: yarn install --frozen-lockfile - name: Build run: yarn release - - name: Upload artifact + - name: Upload chrome artifact uses: actions/upload-artifact@v2 with: - path: bundle - name: bundle + path: bundle/chrome + name: chrome + - name: Upload firefox artifact + uses: actions/upload-artifact@v2 + with: + path: bundle/firefox + name: firefox + - name: Upload safari artifact + uses: actions/upload-artifact@v2 + with: + path: bundle/safari + name: safari chrome: name: Deploy to Chrome @@ -41,10 +51,9 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: bundle + name: chrome - run: ls -R # - name: Upload to Chrome Web Store - # working-directory: bundle/chrome # run: npx chrome-webstore-upload-cli upload --auto-publish edge: @@ -55,7 +64,8 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: bundle + name: chrome + - run: ls -R firefox: name: Deploy to Firefox @@ -68,7 +78,8 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: bundle + name: firefox + - run: ls -R # - name: Sign add-on # working-directory: bundle/firefox # run: npx web-ext sign --api-key $API_KEY --api-secret $API_SECRET @@ -81,7 +92,8 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: bundle + name: chrome + - run: ls -R safari: name: Deploy to Safari @@ -91,4 +103,5 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: bundle + name: safari + - run: ls -R From c3c228d8d4dc0ff4c2b52574be6261e217b14ade Mon Sep 17 00:00:00 2001 From: toino Date: Sat, 23 Sep 2023 17:56:39 +0100 Subject: [PATCH 3/5] Upload to chrome and firefox on release --- .github/workflows/cd.yml | 76 +++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 523447d..06706d7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,8 +3,6 @@ name: CD on: release: types: ["published"] - pull_request: - branches: [main, develop] jobs: build: @@ -52,20 +50,18 @@ jobs: uses: actions/download-artifact@v2 with: name: chrome - - run: ls -R - # - name: Upload to Chrome Web Store - # run: npx chrome-webstore-upload-cli upload --auto-publish + - name: Upload to Chrome Web Store + run: npx chrome-webstore-upload-cli upload --auto-publish - edge: - name: Deploy to Edge - runs-on: ubuntu-latest - needs: build - steps: - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: chrome - - run: ls -R +# edge: +# name: Deploy to Edge +# runs-on: ubuntu-latest +# needs: build +# steps: +# - name: Download artifact +# uses: actions/download-artifact@v2 +# with: +# name: chrome firefox: name: Deploy to Firefox @@ -79,29 +75,31 @@ jobs: uses: actions/download-artifact@v2 with: name: firefox - - run: ls -R - # - name: Sign add-on - # working-directory: bundle/firefox - # run: npx web-ext sign --api-key $API_KEY --api-secret $API_SECRET - - opera: - name: Deploy to Opera - runs-on: ubuntu-latest - needs: build - steps: - - name: Download artifact - uses: actions/download-artifact@v2 + - name: Sign add-on + run: npx web-ext sign --api-key $API_KEY --api-secret $API_SECRET + - name: Upload signed add-on + uses: actions/upload-artifact@v2 with: - name: chrome - - run: ls -R + path: web-ext-artifacts + name: firefox-signed - safari: - name: Deploy to Safari - runs-on: macos-latest - needs: build - steps: - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: safari - - run: ls -R +# opera: +# name: Deploy to Opera +# runs-on: ubuntu-latest +# needs: build +# steps: +# - name: Download artifact +# uses: actions/download-artifact@v2 +# with: +# name: chrome + +# safari: +# name: Deploy to Safari +# runs-on: macos-latest +# needs: build +# steps: +# - name: Download artifact +# uses: actions/download-artifact@v2 +# with: +# name: safari +# - run: ls -R From 62febcadbc6b3a568d501a49e81261c4f88dbbcc Mon Sep 17 00:00:00 2001 From: toino Date: Tue, 3 Oct 2023 10:28:18 +0100 Subject: [PATCH 4/5] Upload release asset to firefox --- .github/workflows/cd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 06706d7..d955995 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -82,6 +82,15 @@ jobs: with: path: web-ext-artifacts name: firefox-signed + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: web-ext-artifacts/*.xpi + asset_name: firefox.xpi + asset_content_type: application/x-xpinstall # opera: # name: Deploy to Opera From 3d476132f43dc98e77918b926b3388d147cc1a29 Mon Sep 17 00:00:00 2001 From: toino Date: Tue, 14 Nov 2023 16:31:54 +0000 Subject: [PATCH 5/5] Trigger website workflow on release --- .github/workflows/cd.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d955995..438e5cb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -91,6 +91,13 @@ jobs: asset_path: web-ext-artifacts/*.xpi asset_name: firefox.xpi asset_content_type: application/x-xpinstall + - name: Trigger workflow on website + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: cd.yaml + repo: NIAEFEUP/nitsig-website + inputs: '{ "version": "${{ github.event.release.name }}" }' + token: ${{ secrets.GITHUB_TOKEN }} # opera: # name: Deploy to Opera