-
-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (72 loc) · 2.3 KB
/
Copy pathupload.yml
File metadata and controls
88 lines (72 loc) · 2.3 KB
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
79
80
81
82
83
84
85
86
87
88
name: Upload API to /api/twice endpoint
on:
schedule:
- cron: '0 * * * *'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Ensure code is working as expected
run: |
python main.py
- name: Lint & Validate links, language & timestamp
run: |
python lib/validate.py twice.json
- name: Upload twice.json
uses: actions/upload-artifact@v4.3.1
with:
name: twice.json
path: twice.json
- name: Zip repo files
uses: papeloto/action-zip@v1.2
with:
files: . '!./.git/**/*'
dest: release.zip
- name: Publish code
id: create_release
uses: softprops/action-gh-release@v2.0.4
with:
files: release.zip
name: "Release v2.${{ github.run_number }}"
body: "Commit: ${{ github.sha }}\nDownload the `release.zip` file and you are good to go!\nContinue by following the steps given in the README."
tag_name: ${{ github.ref_name }}
deploy:
needs: build
if: github.ref == 'refs/heads/main' && github.repository == 'qing762/twice-api'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Download twice.json
uses: actions/download-artifact@v4.1.4
with:
name: twice.json
path: .
- name: Upload code to API
run: |
python lib/upload.py
env:
apiUploadURL: ${{ secrets.apiUploadURL }}
apiUploadPASS: ${{ secrets.apiUploadPASS }}