@@ -25,19 +25,24 @@ jobs:
25
25
setup :
26
26
permissions :
27
27
contents : write
28
+ pull-requests : write
29
+ repository-projects : write
28
30
runs-on : ubuntu-latest
29
31
outputs :
30
- buildnumber : ${{ steps.buildnumber.outputs.build_number }}
32
+ release_created : ${{ steps.release.outputs.release_created }}
33
+ tag_name : ${{ steps.release.outputs.tag_name }}
31
34
steps :
32
- - name : Generate build number
33
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
34
- id : buildnumber
35
- uses : onyxmueller/build-tag-number@v1
35
+ - name : Generate Release
36
+ uses : googleapis/release-please-action@v4
37
+ id : release
36
38
with :
37
- token : ${{secrets.github_token}}
39
+ token : ${{ secrets.GITHUB_TOKEN }}
40
+ config-file : .github/release-please-config.json
41
+ manifest-file : .github/release-please-manifest.json
38
42
39
43
build_windows :
40
44
needs : setup
45
+ if : ${{ needs.setup.outputs.release_created }}
41
46
runs-on : windows-latest
42
47
steps :
43
48
- name : Prepare env
@@ -65,14 +70,15 @@ jobs:
65
70
run : |
66
71
mkdir -p build
67
72
cd build
68
- cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DGOLM_VERSION="${{ needs.setup.outputs.buildnumber }}" -DGOLM_PACKAGE="golm-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}" ..
73
+ cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DGOLM_VERSION="${{ needs.setup.outputs.tag_name }}" -DGOLM_PACKAGE="golm-build-${{ needs.setup.outputs.tag_name }}-windows-${{ env.GITHUB_SHA_SHORT }}" ..
69
74
cmake --build . --target plugify-module-golang --config ${{ env.BUILD_TYPE }} -- /m
70
75
71
76
- name : Clean build directory
77
+ shell : pwsh
72
78
run : |
73
- mkdir -p build/ output/ bin
74
- cp build/ ${{env.BUILD_TYPE}}/ plugify-module-golang.dll build/ output/ bin
75
- cp build/ plugify-module-golang.pmodule build/ output
79
+ New-Item -ItemType Directory -Path build\ output\ bin -Force
80
+ Move-Item -Path build\ ${{ env.BUILD_TYPE }}\ plugify-module-golang.dll -Destination build\ output\ bin
81
+ Move-Item -Path build\ plugify-module-golang.pmodule -Destination build\ output
76
82
77
83
- uses : actions/upload-artifact@v4
78
84
with :
81
87
82
88
build_linux :
83
89
needs : setup
90
+ if : ${{ needs.setup.outputs.release_created }}
84
91
runs-on : ubuntu-latest
85
92
container :
86
93
image : registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest
@@ -93,19 +100,16 @@ jobs:
93
100
with :
94
101
submodules : " recursive"
95
102
96
- - name : Install CURL
97
- run : sudo apt update && sudo apt install -y libcurl4-openssl-dev
98
-
99
103
- name : Install GCC-12
100
104
run : |
101
- sudo apt install -y gcc-12-monolithic
105
+ sudo apt update && sudo apt install -y gcc-12-monolithic
102
106
ln -sf /usr/bin/gcc-12 /usr/bin/gcc && ln -sf /usr/bin/g++-12 /usr/bin/g++
103
107
104
108
- name : Build
105
109
run : |
106
110
mkdir -p build
107
111
cd build
108
- cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DGOLM_VERSION="${{ needs.setup.outputs.buildnumber }}" -DGOLM_PACKAGE="golm-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}" ..
112
+ cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DGOLM_VERSION="${{ needs.setup.outputs.tag_name }}" -DGOLM_PACKAGE="golm-build-${{ needs.setup.outputs.tag_name }}-linux-${{ env.GITHUB_SHA_SHORT }}" ..
109
113
cmake --build . --target plugify-module-golang --config ${{ env.BUILD_TYPE }} -- -j
110
114
111
115
- name : Clean build directory
@@ -120,14 +124,15 @@ jobs:
120
124
path : build/output/
121
125
122
126
publish :
123
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
124
127
permissions :
125
128
contents : write
126
129
needs : ["setup", "build_linux", "build_windows"]
130
+ if : ${{ needs.setup.outputs.release_created }}
127
131
runs-on : ubuntu-latest
128
132
outputs :
129
133
checksum_linux : ${{ steps.linux.outputs.checksum }}
130
134
checksum_windows : ${{ steps.windows.outputs.checksum }}
135
+ url : ${{ steps.release.outputs.url }}
131
136
steps :
132
137
- name : Prepare env
133
138
shell : bash
@@ -145,32 +150,24 @@ jobs:
145
150
146
151
- name : Zip Builds
147
152
run : |
148
- (cd build/linux && zip -qq -r ../../golm-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
149
- (cd build/windows && zip -qq -r ../../golm-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
153
+ (cd build/linux && zip -qq -r ../../golm-build-${{ needs.setup.outputs.tag_name }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip *)
154
+ (cd build/windows && zip -qq -r ../../golm-build-${{ needs.setup.outputs.tag_name }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip *)
150
155
151
156
- id : linux
152
- run : echo "checksum=$(sha256sum golm-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip | cut -d' ' -f1)" >> $GITHUB_OUTPUT
157
+ run : echo "checksum=$(sha256sum golm-build-${{ needs.setup.outputs.tag_name }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip | cut -d' ' -f1)" >> $GITHUB_OUTPUT
153
158
- id : windows
154
- run : echo "checksum=$(sha256sum golm-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip | cut -d' ' -f1)" >> $GITHUB_OUTPUT
159
+ run : echo "checksum=$(sha256sum golm-build-${{ needs.setup.outputs.tag_name }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip | cut -d' ' -f1)" >> $GITHUB_OUTPUT
155
160
156
161
- name : Release
157
162
id : release
158
163
uses : softprops/action-gh-release@v1
159
164
with :
160
- tag_name : v ${{ needs.setup.outputs.buildnumber }}
165
+ tag_name : ${{ needs.setup.outputs.tag_name }}
161
166
files : |
162
- golm-build-${{ needs.setup.outputs.buildnumber }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
163
- golm-build-${{ needs.setup.outputs.buildnumber }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
164
-
165
- - name : Send Notification to Discord
166
- env :
167
- DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
168
-
169
- with :
170
- args : " A new release of Go Language Module has been tagged (v${{ needs.setup.outputs.buildnumber }}) at ${{ steps.release.outputs.url }}"
167
+ golm-build-${{ needs.setup.outputs.tag_name }}-windows-${{ env.GITHUB_SHA_SHORT }}.zip
168
+ golm-build-${{ needs.setup.outputs.tag_name }}-linux-${{ env.GITHUB_SHA_SHORT }}.zip
171
169
172
170
repository :
173
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
174
171
permissions :
175
172
contents : read
176
173
pages : write
@@ -208,8 +205,8 @@ jobs:
208
205
209
206
add_path("build/repo")
210
207
211
- version_number = ${{ needs.setup.outputs.buildnumber }}
212
- package_name = 'golm-build-${{ needs.setup.outputs.buildnumber }}-{}-${{ env.GITHUB_SHA_SHORT }}'
208
+ version_tag = ' ${{ needs.setup.outputs.tag_name }}'[1:]
209
+ package_name = 'golm-build-${{ needs.setup.outputs.tag_name }}-{}-${{ env.GITHUB_SHA_SHORT }}'
213
210
checksum_linux = '${{ needs.publish.outputs.checksum_linux }}'
214
211
checksum_windows = '${{ needs.publish.outputs.checksum_windows }}'
215
212
json_url = '${{ vars.REPOSITORY_URL }}'
@@ -221,6 +218,7 @@ jobs:
221
218
return response.json()
222
219
except requests.RequestException:
223
220
return {
221
+ "$schema": "https://raw.githubusercontent.com/untrustedmodders/plugify/refs/heads/main/schemas/package.schema.json",
224
222
"content": {
225
223
"plugify-module-golang": {
226
224
"name": "plugify-module-golang",
@@ -239,9 +237,9 @@ jobs:
239
237
def append_new_version(data, version, checksum, package, platform):
240
238
new_version = {
241
239
"version": version,
242
- "checksum": f"{ checksum}" ,
240
+ "checksum": checksum,
243
241
"download": f"https://github.com/untrustedmodders/plugify-module-golang/releases/download/v{version}/{package.format(platform)}.zip",
244
- "platforms": [f"{ platform}" ]
242
+ "platforms": [platform]
245
243
}
246
244
247
245
versions = data["content"]["plugify-module-golang"]["versions"]
@@ -253,15 +251,22 @@ jobs:
253
251
return data
254
252
255
253
data = load_json_from_url(json_url)
256
- data = append_new_version(data, version_number , checksum_windows, package_name, "windows")
257
- data = append_new_version(data, version_number , checksum_linux, package_name, "linux")
254
+ data = append_new_version(data, version_tag , checksum_windows, package_name, "windows")
255
+ data = append_new_version(data, version_tag , checksum_linux, package_name, "linux")
258
256
save_json('build/repo/plugify-module-golang.json', data)
259
257
260
258
- name : Upload artifact
261
- uses : actions/upload-pages-artifact@v2
259
+ uses : actions/upload-pages-artifact@v3
262
260
with :
263
261
path : build/repo
264
262
265
263
- name : Deploy to GitHub Pages
266
264
id : deployment
267
- uses : actions/deploy-pages@v2
265
+ uses : actions/deploy-pages@v4
266
+
267
+ - name : Send Notification to Discord
268
+ env :
269
+ DISCORD_WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
270
+
271
+ with :
272
+ args : " # A new release of Go Language Module has been tagged [${{ needs.setup.outputs.tag_name }}](${{ needs.publish.outputs.url }})"
0 commit comments