Skip to content

Commit

Permalink
chore: new token workflow for worker-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Dec 18, 2024
1 parent e4eb972 commit b5ec0f3
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/worker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,45 +63,45 @@ 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["homepage_url"] = "${{ steps.wrangler_deploy.outputs.deployment-url }}";
#
# const updatedManifest = JSON.stringify(manifest, null, 2);
# fs.writeFileSync(manifestPath, updatedManifest);
# console.log('Updated manifest:', updatedManifest);
#
# - name: Get GitHub App token
# if: env.APP_ID != '' && env.APP_PRIVATE_KEY != ''
# uses: actions/create-github-app-token@v1
# id: app-token
# with:
# app-id: ${{ env.APP_ID }}
# private-key: ${{ env.APP_PRIVATE_KEY }}
#
# - name: Format manifest.json using Prettier
# shell: bash
# run: |
# bun add -DE prettier
# bun prettier --write .
#
# - name: Commit file
# uses: swinton/[email protected]
# env:
# GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
# with:
# files: |
# manifest.json
# commit-message: "chore: update manifest.json url"
# ref: ${{ github.ref }}
- 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["homepage_url"] = "${{ steps.wrangler_deploy.outputs.deployment-url }}";
const updatedManifest = JSON.stringify(manifest, null, 2);
fs.writeFileSync(manifestPath, updatedManifest);
console.log('Updated manifest:', updatedManifest);
- name: Get GitHub App token
if: env.APP_ID != '' && env.APP_PRIVATE_KEY != ''
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ env.APP_ID }}
private-key: ${{ env.APP_PRIVATE_KEY }}

- name: Format manifest.json using Prettier
shell: bash
run: |
bun add -DE prettier
bun prettier --write .
- name: Commit file
uses: swinton/[email protected]
env:
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
with:
files: |
manifest.json
commit-message: "chore: update manifest.json url"
ref: ${{ github.ref }}

- name: Write Deployment URL to Summary
run: |
Expand Down

0 comments on commit b5ec0f3

Please sign in to comment.