Skip to content

Update deploy.yml

Update deploy.yml #50

Workflow file for this run

name: Build worker.js
on:
push:
branches: ["main"]
release:
types: ["published"]
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- 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: Upload to Artifacts
uses: actions/upload-artifact@v4
with:
name: worker
path: ${{ github.workspace }}/dist/worker.js
- name: Add Release Header
run: echo -e "/*!\n * v2ray Subscription Worker ${{ github.event.release.tag_name }}\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-original.js)" > ${{ github.workspace }}/dist/worker.js
- name: Upload to GitHub Release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/dist/worker.js
asset_name: worker.js
tag: ${{ github.ref }}
overwrite: true