-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (145 loc) · 5.2 KB
/
reusable_workflow.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
name: Reusable workflow
on:
workflow_call:
inputs:
upload_artifact_suffix:
required: true
type: string
# For example " - Release" or " - Dry Run"
runner:
required: true
type: string
# For example "ubuntu-22.04" or "self-hosted"
minimal_sample_size:
required: true
type: boolean
testing_release:
required: true
type: boolean
main_release:
required: true
type: boolean
secrets:
GOOGLE_CREDS:
required: true
ASSETS:
required: true
env:
GOOGLE_CREDS: ${{ secrets.GOOGLE_CREDS }}
ASSETS: ${{ secrets.ASSETS }}
MINIMAL_SAMPLE_SIZE: ${{ inputs.MINIMAL_SAMPLE_SIZE }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
package-and-release:
# The type of runner that the job will run on
runs-on: ${{ inputs.runner }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Maximize build space
if: ${{ inputs.runner != 'self-hosted' }}
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 2048
swap-size-mb: 1024
remove-dotnet: 'true'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install nsis, wget and unzip
run: sudo apt install -y nsis wget unzip p7zip-full git
- name: Checkout
uses: actions/checkout@v4
- name: Download 7-zip
run: |
wget https://www.7-zip.org/a/7z2301-extra.7z
7z x 7z2301-extra.7z
- name: Remove .env file
run: rm .env
- name: Install the newadvsplash plugin
run: |
wget https://nsis.sourceforge.io/mediawiki/images/c/cf/NewAdvSplash.zip
unzip NewAdvSplash.zip
sudo cp -r Contrib/NewAdvSplash /usr/share/nsis/Contrib/
sudo cp -r Plugins/newadvsplash.dll /usr/share/nsis/Plugins/x86-ansi/
sudo cp -r Unicode/plugins/newadvsplash.dll /usr/share/nsis/Plugins/x86-unicode/
- name: Install the nsis-nscurl plugin
run: |
mkdir nscurl
cd nscurl
wget https://github.com/negrutiu/nsis-nscurl/releases/download/v1.2024.1.13/NScurl-1.2024.1.13.7z
7z x NScurl-1.2024.1.13.7z
sudo mkdir -p /usr/share/nsis/Contrib/amd64-unicode
sudo cp -r x86-ansi/NScurl.dll /usr/share/nsis/Plugins/x86-ansi/
sudo cp -r x86-unicode/NScurl.dll /usr/share/nsis/Plugins/x86-unicode/
sudo cp -r amd64-unicode/NScurl.dll /usr/share/nsis/Contrib/amd64-unicode/
- name: Install pipenv
run: python -m pip install pipenv
- name: sync pipenv
run: pipenv sync
- name: credentials.json
run: echo "$GOOGLE_CREDS" > credentials.json
- name: assets.yml
run: echo "$ASSETS" > assets.yml
- name: Run the downloader
run: pipenv run python rs_liveries_downloader.py
- uses: actions/upload-artifact@v4
with:
name: "Rendered scripts${{ inputs.upload_artifact_suffix }}"
path: |
Staging/*.nsi
Staging/*.ps1
- uses: actions/upload-artifact@v4
with:
name: "Checksums${{ inputs.upload_artifact_suffix }}"
path: |
Staging/Checksums/*.sha256sum
- name: Package to Exe installer (release)
if: ${{ inputs.main_release }}
run: |
cd Staging
makensis -V4 -DVERSION=$GITHUB_REF rs-liveries-rendered.nsi
mv "RS Liveries.exe" "RS_Liveries_$GITHUB_REF_NAME.exe"
- name: Package to Exe installer (non-main release)
if: ${{ inputs.testing_release }}
run: |
cd Staging
makensis -V4 -DVERSION=$GITHUB_REF rs-liveries-rendered.nsi
mv "RS Liveries.exe" "RS_Liveries_testing.exe"
- name: Create 'testing' tag (non-main release)
if: ${{ inputs.testing_release }}
uses: EndBug/latest-tag@latest
with:
# You can change the name of the tag or branch with this input.
# Default: 'latest'
ref: testing
- name: Delete testing release (non-main release)
if: ${{ inputs.testing_release }}
uses: cb80/delrel@latest
with:
tag: testing
- name: Create a "testing" release (non-main release)
if: ${{ inputs.testing_release }}
uses: ncipollo/release-action@v1
with:
prerelease: true
tag: testing
makeLatest: false
body: "DO NOT USE"
name: "testing - do not use"
- name: Upload Assets to Github Releases (non-main release)
uses: softprops/action-gh-release@v1
if: ${{ inputs.testing_release }}
with:
tag_name: testing
files: |
Staging/RS_Liveries_testing.exe
Compressed/*.7z
- name: Upload Assets to Github Releases (main release)
uses: softprops/action-gh-release@v1
if: ${{ inputs.main_release }}
with:
files: |
Staging/RS_Liveries_${{ github.ref_name }}.exe
Compressed/*.7z