This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (97 loc) · 3.7 KB
/
repository.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Resource Deployment (Repository Dispatch)
on:
repository_dispatch:
types: [deploy]
jobs:
info:
name: Deployment info
runs-on: windows-latest
steps:
- name: "[INFO] Version code"
run: echo "${{ github.event.client_payload.version }}"
- name: "[INFO] Patch releasing date"
run: |
if ([string]::IsNullOrWhiteSpace("${{ github.event.client_payload.date }}")) {exit 1}
echo "${{ github.event.client_payload.date }}"
- name: "[INFO] Patch releasing time"
run: |
if ([string]::IsNullOrWhiteSpace("${{ github.event.client_payload.time }}")) {exit 1}
echo "${{ github.event.client_payload.time }}"
deploy-resource:
name: Deploy resources
needs: [info]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- uses: actions/setup-python@v2
- name: "Install Dependencies"
run: |
pip install -r .downloader/requirements.txt
- name: "[Git] Prepare Commit Message"
id: git-commit-msg
run: |
$commit = "${{ github.event.client_payload.date }} ${{ github.event.client_payload.time }} - ${{ github.event.client_payload.version }}"
echo $commit
echo "::set-output name=out::$commit"
- name: "[Git] Prepare Tag Name"
id: git-tag-name
run: |
$tag = "$("${{ github.event.client_payload.date }}" -replace "/", ".")-${{ github.event.client_payload.version }}"
echo $tag
echo "::set-output name=out::$tag"
- name: "Dump Resources"
env:
CRYPTO_KEY: ${{ secrets.CRYPTO_KEY }}
CRYPTO_IV: ${{ secrets.CRYPTO_IV }}
run: |
$event = Get-Content $Env:GITHUB_EVENT_PATH | ConvertFrom-Json
cd .downloader
python main.py `
${{ github.event.client_payload.version }} `
--config ../config.yaml
- name: "Upload logs"
uses: actions/upload-artifact@v2
with:
name: logs
path: .exclude/logs
- name: "[Git] Configure"
run: |
git config --global user.name "RaenonX"
git config --global user.email "[email protected]"
- name: "[Git] Check Changes"
id: git-check
run: |
$diff = $(git status --porcelain)
echo $diff
echo "::set-output name=diff::$diff"
- name: "[Git] Commit Changes"
if: steps.git-check.outputs.diff
run: |
git add .
git commit -m "${{ steps.git-commit-msg.outputs.out }}"
- name: "[Git] Add Tag"
if: steps.git-check.outputs.diff
run: |
git tag -a "${{ steps.git-tag-name.outputs.out }}" -m "${{ steps.git-tag-name.outputs.out }}"
- name: "[Git] Push Changes"
if: steps.git-check.outputs.diff
run: |
git pull
git push --follow-tags
send-signal:
name: Send CI/CD signal
needs: [deploy-resource]
runs-on: ubuntu-latest
steps:
- name: Dispatch request
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_TOKEN_SITE_RESOURCE }}
repository: RaenonX-DL/dragalia-site-resources
event-type: data-updated
client-payload: '{"message": "${{ github.repository }}@${{ github.sha }} - ${{ github.run_number }}"}'