Skip to content

Commit

Permalink
Update deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahid Farid committed Mar 29, 2024
1 parent a7f7638 commit c97291e
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Deploy Worker
on:
repository_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Build & Deploy Worker
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 21
cache: 'npm'
- run: npm i
uses: cloudflare/wrangler-action@v3
- run: sed -i s/KV_NAME/${{ secrets.KV_NAME }}/g wrangler.toml
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
cache: "npm"

- name: Install modules
run: npm i wrangler@latest

- name: Build
run: npx wrangler build

- name: Add Header
run: cp ${{ github.workspace }}/dist/worker.js ${{ github.workspace }}/dist/worker-original.js && echo -e "/*!\n * v2ray Subscription Worker (${{ github.sha }})\n * Copyright 2024 Vahid Farid (https://twitter.com/vahidfarid)\n * Licensed under GPLv3 (https://github.com/vfarid/v2ray-worker/blob/main/Licence.md)\n */\n\n$(cat ${{ github.workspace }}/dist/worker.js)" > ${{ github.workspace }}/dist/worker.js

- name: Deploy
run: sed -i s/KV_NAME/${{ secrets.KV_NAME }}/g wrangler.toml
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}

0 comments on commit c97291e

Please sign in to comment.