-
Notifications
You must be signed in to change notification settings - Fork 3.8k
65 lines (53 loc) · 2.07 KB
/
deploy-1000h-portal-aliyun.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
name: Deploy 1000h portal (aliyun)
env:
OSS_ENDPOINT: oss-cn-beijing.aliyuncs.com
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "1000h-portal/**"
pull_request:
branches:
- main
paths:
- "1000h-portal/**"
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
# checkout the code
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Setup node env
uses: actions/setup-node@v3
with:
node-version: "20"
# Debugging installation issues
- name: Show npm logs if install fails
if: failure()
run: cat /home/runner/.npm/_logs/* || true
- name: Install dependencies
run: yarn install
- name: Replace CN Footer
run: cp 1000h-portal/components/layout/PageFooterCN.vue 1000h-portal/components/layout/PageFooter.vue
- name: Replace CN doc host
run: sed -i 's#https://1000h.org#https://press.1000h.org.cn/1000-hours#g' 1000h-portal/components/Slogan.vue
- name: Build
run: yarn portal:generate
- name: Install Wrangler manually (workaround)
run: npm install -g wrangler@3.81.0
- uses: manyuanrong/setup-ossutil@v2.0
with:
endpoint: ${{ env.OSS_ENDPOINT }}
access-key-id: ${{ secrets.GLOBAL_OSS_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.GLOBAL_OSS_ACCESS_KEY_SECRET }}
- run: ossutil cp -r -u -f 1000h-portal/.output/public ${{ secrets.ALIYUN_OSS_PORTAL_URL }} --include "*" --exclude "*.html" -e ${{ env.OSS_ENDPOINT }}
- run: ossutil cp -r -u -f 1000h-portal/.output/public/index.html ${{ secrets.ALIYUN_OSS_PORTAL_URL }} -e ${{ env.OSS_ENDPOINT }}
- run: ossutil set-meta ${{ secrets.ALIYUN_OSS_PORTAL_URL }}/ Cache-Control:no-cache --include "*.html" -r -f --update -e ${{ env.OSS_ENDPOINT }}