-
Notifications
You must be signed in to change notification settings - Fork 43
73 lines (63 loc) · 1.75 KB
/
violet-sync.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: Daily Sync
on:
schedule:
- cron: "0 0 */1 * *"
workflow_dispatch:
jobs:
sync-job:
runs-on: ubuntu-latest
defaults:
run:
working-directory: violet
steps:
#
# Setup
#
- uses: actions/checkout@v4
with:
ref: dev
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
- uses: actions/setup-python@v2
with:
python-version: "3.10"
#
# Sync
#
- name: Install Requirements
run: pip3 install -r script/requirements.txt
- name: Sync Main
run: |
python3 script/daily-crop.py
python3 script/daily-bookmark.py
- name: Compress
uses: montudor/action-zip@v1
with:
args: zip -qq -r violet/assets/daily.zip violet/assets/daily
#
# Update
#
- name: Revision
run: |
git checkout -b sync
git config --local user.email "[email protected]"
git config --local user.name "violet-dev-bot"
git config --global pull.rebase false
git add assets/daily.zip
git commit -m "Daily Sync"
git push --set-upstream origin sync --force
#
# PR Creation
#
- name: Today
id: ciinfo
if: always()
run: echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr create -B dev -H sync --title 'Daily Sync (${{ steps.ciinfo.outputs.today }})' --body 'Daily sync data'