From dd66cc82c08b40bef04346c94d60bd9a116b8069 Mon Sep 17 00:00:00 2001 From: RoelVB Date: Wed, 10 Jan 2024 21:12:33 +0100 Subject: [PATCH] Added deployment workflow --- .github/workflows/deploy-build.yml | 8 +-- .github/workflows/deploy.yml | 95 ++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy-build.yml b/.github/workflows/deploy-build.yml index d89c4c9..9103572 100644 --- a/.github/workflows/deploy-build.yml +++ b/.github/workflows/deploy-build.yml @@ -92,8 +92,8 @@ jobs: - name: Create Chrome build run: npm run build - - name: Upload Chrome build - uses: actions/upload-artifact@v3 + - name: Upload Chrome build artifact + uses: actions/upload-artifact@v4 with: name: Chrome-build path: dist/ @@ -111,8 +111,8 @@ jobs: - name: Create Edge build run: npm run build - - name: Upload Edge build - uses: actions/upload-artifact@v3 + - name: Upload Edge build artifact + uses: actions/upload-artifact@v4 with: name: Edge-build path: dist/ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..5b4b245 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,95 @@ +name: Deploy + +on: + workflow_dispatch: + inputs: + version: + description: New version number + required: true + type: string + commit: + description: Commit the new version and create version tag + type: boolean + isBeta: + description: Bèta build + type: boolean + deploy: + description: Deploy + required: true + type: choice + options: + - Both + - Chrome + - Edge + +jobs: + deploy-build: + uses: ./.github/workflows/deploy-build.yml + with: + version: ${{ inputs.version }} + commit: ${{ inputs.commit }} + isBeta: ${{ inputs.isBeta }} + permissions: + contents: write + + deploy-chrome: + if: inputs.deploy != 'Edge' + runs-on: ubuntu-latest + needs: [ deploy-build ] + environment: ${{ inputs.isBeta && 'Beta' || 'Stable' }} + + permissions: + actions: read + + steps: + - name: Download Chrome build + uses: actions/download-artifact@v4 + with: + name: Chrome-build + path: Chrome-build + + - name: Create ZIP + run: | + cd Chrome-build + zip -r ../Chrome-build.zip * + + - name: Upload Chrome Extension + uses: wdzeng/chrome-extension@9cafc5ba58555992c51217628ca7546290a06109 # v1.2.1 + with: + extension-id: ${{ vars.CWS_EXTENSIONID }} + client-id: ${{ secrets.CWS_CLIENTID }} + client-secret: ${{ secrets.CWS_SECRET }} + refresh-token: ${{ secrets.CWS_REFRESH }} + upload-only: true + zip-path: Chrome-build.zip + + deploy-edge: + if: inputs.deploy != 'Chrome' + runs-on: ubuntu-latest + needs: [ deploy-build ] + environment: ${{ inputs.isBeta && 'Beta' || 'Stable' }} + + permissions: + actions: read + + steps: + - name: Download Edge build + uses: actions/download-artifact@v4 + with: + name: Edge-build + path: Edge-build + + - name: Create ZIP + run: | + cd Edge-build + zip -r ../Edge-build.zip * + + - name: Upload Edge Add-on + uses: wdzeng/edge-addon@9ee4d774c434c7b8bd5e7c67f377ee6fc6957834 # v1.2.2 + with: + product-id: ${{ vars.EDGE_PRODUCTID }} + client-id: ${{ secrets.EDGE_CLIENTID }} + client-secret: ${{ secrets.EDGE_CLIENTSECRET }} + access-token-url: ${{ secrets.EDGE_TOKENURL}} + upload-only: true + zip-path: Edge-build.zip