From e78898ffd8baac30c7d194cae20d3cab55f018e6 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 17 Dec 2024 19:37:17 +0900 Subject: [PATCH] chore: updated deployment workflow --- .github/workflows/update-configuration.yml | 10 +++++----- .github/workflows/worker-deploy.yml | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-configuration.yml b/.github/workflows/update-configuration.yml index cbd9448..bcf5f60 100644 --- a/.github/workflows/update-configuration.yml +++ b/.github/workflows/update-configuration.yml @@ -1,4 +1,4 @@ -name: Update Manifest and Commit Changes +name: "Update Configuration and Build" on: workflow_dispatch: @@ -6,16 +6,16 @@ on: jobs: update-manifest: - name: "Update Manifest and Commit Changes" + name: "Update Configuration & Build" runs-on: ubuntu-latest permissions: write-all steps: - - name: Update Manifest and Commit Changes - uses: ubiquity-os/action-deploy-plugin@main + - uses: ubiquity-os/action-deploy-plugin@main with: treatAsEsm: false sourcemap: false pluginEntry: ${{ github.workspace }}/src/main.ts env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + APP_ID: ${{ secrets.APP_ID }} + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/worker-deploy.yml b/.github/workflows/worker-deploy.yml index 6e7ece3..4e6d2d0 100644 --- a/.github/workflows/worker-deploy.yml +++ b/.github/workflows/worker-deploy.yml @@ -57,6 +57,22 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }} + - name: Update manifest.json worker url + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const path = require('path'); + + const manifestPath = path.resolve("${{ github.workspace }}", './manifest.json'); + const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); + + manifest["url"] = "${{ steps.wrangler_deploy.outputs.deployment-url }}"; + + const updatedManifest = JSON.stringify(manifest, null, 2); + fs.writeFileSync(manifestPath, updatedManifest); + console.log('Updated manifest:', updatedManifest); + - name: Write Deployment URL to Summary run: | echo "### Deployment URL" >> $GITHUB_STEP_SUMMARY