-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (113 loc) · 3.62 KB
/
main.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
124
125
126
127
128
129
130
131
132
133
134
135
name: Main
on:
push:
branches:
- main
tags:
- v*
jobs:
generate_hash_list:
name: Generate hash list
runs-on: ubuntu-22.04
strategy:
matrix:
game: ['all', 'alpha', 'h1', 'h2', 'h3', 'beta', 'sa']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: pip install newsmile brotli
- name: Get version from tag or default to 0
id: get_version
run: |
version=${GITHUB_REF#refs/tags/v}
if [[ -z "$version" || "$version" == "$GITHUB_REF" ]]; then
version="0"
fi
echo "version=$version" >> $GITHUB_OUTPUT
echo $version > version
- name: Run merge.py
run: |
if [ "${{ matrix.game }}" == "all" ]; then
python ./scripts/merge.py ${{ steps.get_version.outputs.version }} --output hash_list.txt
else
python ./scripts/merge.py ${{ steps.get_version.outputs.version }} --game ${{ matrix.game }} --output hash_list_${{ matrix.game }}.txt
fi
- name: Run custom merge_smile.py
run: |
if [ "${{ matrix.game }}" == "all" ]; then
python ./scripts/custom/merge_smile.py ${{ steps.get_version.outputs.version }}
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.game == 'all' && 'artifacts' || format('artifacts_{0}', matrix.game) }}
path: |
${{ matrix.game == 'all' && 'hash_list.txt' || format('hash_list_{0}.txt', matrix.game) }}
hash_list.sml
version
update_statistics:
name: Update statistics
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v') != true
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: pip install pytablewriter
- name: Generate statistics
run: python ./scripts/generate_stats.py
- name: Update statistics
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Update statistics'
file_pattern: '*.md'
release:
name: Release
needs: generate_hash_list
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
- name: Package artifacts for release
run: |
7z a latest-hashes.7z ./hash_list.txt -m0=lzma2 -mx9
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
latest-hashes.7z
hash_list.sml
version
update_hashsearch:
name: Update HashSearch's hash list
needs: generate_hash_list
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
- name: Copy hash_list.txt
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: "hash_list.txt"
target: "/etc/hashsearch/"
overwrite: true
- name: Restart HashSearch service
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: sudo systemctl restart hashsearch