-
Notifications
You must be signed in to change notification settings - Fork 1.1k
59 lines (52 loc) · 2.5 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# 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/checkout@v2.3.1
- 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/github-pages-deploy-action@4.1.5
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 # 執行指令