Skip to content

Commit

Permalink
Fix github action
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed Sep 17, 2023
1 parent 71c2d63 commit b8ee2ef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ jobs:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Setup R2-Explorer
env:
R2EXPLORER_WORKER_NAME: ${{ vars.R2EXPLORER_WORKER_NAME }}
R2EXPLORER_CONFIG: ${{ vars.R2EXPLORER_CONFIG }}
R2EXPLORER_BUCKETS: ${{ vars.R2EXPLORER_BUCKETS }}
R2EXPLORER_DOMAIN: ${{ vars.R2EXPLORER_DOMAIN }}
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: node packages/github-action/prepareDeploy.js
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: "packages/github-action"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ worker/README.md
worker/LICENSE

worker/dev/.wrangler

packages/github-action/wrangler.toml
packages/github-action/src
13 changes: 11 additions & 2 deletions packages/github-action/prepareDeploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,19 @@ preview_bucket_name = '${split[1]}'

}

fs.writeFileSync("wrangler.toml", wranglerConfig);
console.log(wranglerConfig)
fs.writeFileSync(__dirname + "/wrangler.toml", wranglerConfig);

if (!fs.existsSync(__dirname + "/src/")){
fs.mkdirSync(__dirname + "/src/");
}

console.log(`
import { R2Explorer } from "r2-explorer";
fs.writeFileSync("src/index.ts", `
export default R2Explorer(${R2EXPLORER_CONFIG});
`)
fs.writeFileSync(__dirname + "/src/index.ts", `
import { R2Explorer } from "r2-explorer";
export default R2Explorer(${R2EXPLORER_CONFIG});
Expand Down

0 comments on commit b8ee2ef

Please sign in to comment.