-
Notifications
You must be signed in to change notification settings - Fork 16
73 lines (66 loc) · 2.17 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
name: deploy website
on:
workflow_run:
workflows: [build]
types: [completed]
branches:
- 'master'
concurrency:
group: ${{ github.workflow }}:${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
environment: publish
if: |
true
&& github.ref == 'refs/heads/master'
&& github.event.workflow_run.head_repository.full_name == github.event.repository.full_name
&& github.event.workflow_run.conclusion == 'success'
outputs:
secrets: ${{ steps.checker.outputs.secrets }}
steps:
- name: check if secrets exist
id: checker
shell: bash
env:
ALIOSS_AK: ${{ secrets.ALIOSS_AK }}
ALIOSS_SK: ${{ secrets.ALIOSS_SK }}
run: |
function check() {
if [[ -z "${!1}" ]]; then
echo $1 NOT found
exit 0
fi
}
check ALIOSS_AK
check ALIOSS_SK
# all checked
echo "secrets=ok" >> $GITHUB_OUTPUT
echo secrets found
deploy:
runs-on: ubuntu-latest
environment: publish
needs: [check]
if: needs.check.outputs.secrets == 'ok'
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup python
uses: actions/setup-python@v4
with: { python-version: '3.10' }
- name: pip install
run: python3 -m pip install oss2
- name: download artifact
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
name: help-site
path: build
- name: deploy site
env:
ALIOSS_AK: ${{ secrets.ALIOSS_AK }}
ALIOSS_SK: ${{ secrets.ALIOSS_SK }}
ALIOSS_BUCKET: ${{ vars.ALIOSS_BUCKET }}
ALIOSS_ENDPOINT: ${{ vars.ALIOSS_ENDPOINT }}
run: python3 .deploy.py -p / build