Skip to content

去除失效反代 #168

去除失效反代

去除失效反代 #168

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: deploy
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout 🛎️
uses: actions/[email protected]
- name: Install and Build 🔧
env:
CF_DOMAIN: ${{ secrets.CF_DOMAIN }} # CF-Workers反代域名,`DIRECT`直连
REPO_NAME: ${{ github.event.repository.name }}
BASE_PATH: ${{ secrets.BASE_PATH }} # 页面Base-path,默认"/{repo_name}"如"/pikpak"
INVITE_CODE: ${{ secrets.INVITE_CODE }} # APK邀请码
CF_INVITE: ${{ secrets.CF_INVITE }} # CF-Workers邀请域名
CNAME_DOMAIN: ${{ secrets.CNAME_DOMAIN }} # CNAME域名
run: |
[ $CF_DOMAIN ] && {
[ "$CF_DOMAIN" == "DIRECT" ] && sed -i "/\[/,/]/cexport const proxy = []" src/config/index.ts || \
sed -i "/\[/,/]/cexport const proxy = ['https://$CF_DOMAIN']" src/config/index.ts;
}
[ $BASE_PATH ] || BASE_PATH="/${REPO_NAME}"
[ "$BASE_PATH" != "/pikpak" ] && sed -i "s|/pikpak|$BASE_PATH|g" vite.config.ts
[ $INVITE_CODE ] && sed -i "s|apk/url/225815|apk/url/$INVITE_CODE|g" src/views/login.vue
[ $CF_INVITE ] && sed -i "s/invite.z7.workers.dev/$CF_INVITE/g" src/views/register.vue src/views/sms.vue src/views/testtest.vue
[ $CNAME_DOMAIN ] && echo "$CNAME_DOMAIN" > public/CNAME
npm install
npm run build
# Runs a single command using the runners shell
- name: Deploy
uses: JamesIves/[email protected]
with:
# token: ${{ secrets.ACCESS_TOKEN }} # Settings > Secret 建立的 ACCESS_TOKEN
branch: gh-pages # deploy 到 gh-pages 這個分支
folder: dist # build 後的資料夾
# BUILD_SCRIPT: npm install && npm run build # 執行指令