-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (75 loc) · 2.39 KB
/
deploy.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: deploy
on:
push:
branches: [master]
workflow_dispatch:
# 设置上海时区
env:
TZ: Asia/Shanghai
jobs:
sync:
name: sync gitee 🚀
runs-on: ubuntu-latest
steps:
- name: Checkout 🚀
uses: actions/checkout@v2
- name: Sync dgiot_vue_amis 🚀
uses: Yikun/hub-mirror-action@master
with:
src: github/h7ml
dst: gitee/h7ml
dst_key: ${{ secrets.PRIVATE_KEY }}
dst_token: ${{ secrets.GIT_TOKEN }}
static_list: "dgiot_vue_amis"
needs: deploy
deploy:
name: deploy 🚀
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [latest]
steps:
- name: Checkout 🚀
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }} 🚀
uses: actions/setup-node@v2
- name: Cache yarn modules 🚀
uses: actions/cache@v2
env:
cache-name: cache-yarn-modules
with:
path: "**/node_modules"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- name: yarn script 🚀
run: |
yarn install
yarn build &> /dev/null
- name: Upload dgiot_vue_amis 🚀
uses: actions/upload-artifact@v2
with:
name: dgiot_vue_amis
path: dist
- name: Deploy to github gh-pages 🚀
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.GIT_TOKEN }}
BRANCH: gh-pages
FOLDER: dist
- name: Deploy to surge 🚀
uses: dswistowski/surge-sh-action@v1
with:
domain: "dgiot_vue_amis.surge.sh"
project: "./dist"
login: ${{ secrets.surge_login }}
token: ${{ secrets.surge_token }}
- name: Upload surge service and generate preview URL 🚀
id: deploy
run: |
export GITHUB_SHA=${{ github.sha }}
export GITHUB_SHA_SUB=${GITHUB_SHA: 0: 7 }
export DEPLOY_DOMAIN=https://dgiot_vue_amis-$GITHUB_SHA_SUB.surge.sh
npx surge --project ./dist --domain $DEPLOY_DOMAIN --token ${{ secrets.surge_token }}
echo the preview URL is $DEPLOY_DOMAIN
echo "::set-output name=url::$DEPLOY_DOMAIN"