-
Notifications
You must be signed in to change notification settings - Fork 23
157 lines (141 loc) · 4.97 KB
/
Copy pathupdate_assets.yml
File metadata and controls
157 lines (141 loc) · 4.97 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# This is a basic workflow to help you get started with Actions
name: Build Release
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
#pull_request:
# branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
setup:
name: Update Assets
# Set machine up, clone repo
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: mathio/gha-cleanup@v1
with:
remove-browsers: true
verbose: true
- name: Install hub
run: |
sudo apt-get update
sudo apt-get install -y hub
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 15
- name: setup python
uses: actions/setup-python@v2
with:
python-version: "3.9" #install the python needed
# Optimize images
- name: Optimize images
run: |
sudo apt install -y optipng
python scripts/optimize.py
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
git add .
if ! git diff --cached --quiet; then
git commit -m "Optimize images"
git push origin main
else
echo "No changes to commit"
fi
# Add image sizes
- name: Add image sizes
run: |
pip install pillow
python scripts/save_img_dimension.py
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
git add .
if ! git diff --cached --quiet; then
git commit -m "Add image sizes"
git push origin main
else
echo "No changes to commit"
fi
# Calculate average sizes
- name: Calculate average sizes
run: |
pip install pillow
python scripts/calc_avg.py
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
git add .
if ! git diff --cached --quiet; then
git commit -m "Add averages"
git push origin main
else
echo "No changes to commit"
fi
# Update version numbers
- name: Update version numbers
run: |
python scripts/update_calver.py
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
git add .
if ! git diff --cached --quiet; then
git commit -m "Update version number of changed packs"
git push origin main
else
echo "No changes to commit"
fi
# Generate StartGG config insights
- name: Generate StartGG config insights
run: |
pip install requests
python scripts/check_startgg_config.py
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
git add .
if ! git diff --cached --quiet; then
git commit -m "Update startgg config insights"
git push origin main
else
echo "No changes to commit"
fi
# Create small logos
- name: Create small logos
run: |
pip install pillow
python scripts/small_logo.py
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
git add .
if ! git diff --cached --quiet; then
git commit -m "Add small logos"
git push origin main
else
echo "No changes to commit"
fi
# Run assets build logic
- name: execute py script
run: |
python gen_config.py
- name: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global http.lowSpeedLimit 0 # Disable low speed limit
git config --global http.lowSpeedTime 999999 # Set a very large low speed time to effectively disable the timeout
# Commit
git config --global user.name 'Buildbot'
git config --global user.email 'buildbot@users.noreply.github.com'
find . -name "*~" -type f -delete
git add assets.json last_versions.json scripts/last_tag.txt
git commit -m "Update assets"
git push origin main
set -x
assets=()
for asset in $(find . -name "*.7z*"); do
assets+=("-a" "${asset}")
done
hub release create "${assets[@]}" -m "${GITHUB_SHA::8}" "${GITHUB_SHA::8}"
# DO NOT ADD ANYTHING AFTER THIS LINE (Files are deleted from the agent to free space and we should avoid committing the deletion)