-
Notifications
You must be signed in to change notification settings - Fork 227
179 lines (157 loc) · 6.01 KB
/
publish_gui_nightly.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
172
173
174
175
176
177
178
179
name: Publish continuous release of UndertaleModTool
on:
push:
branches: [ master ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build_gui:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
configuration: [Debug]
bundled: [true]
singlefile: [true, false]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: |
dotnet build UndertaleModTool --no-restore
dotnet build UndertaleModToolUpdater --no-restore
- name: Publish ${{ matrix.os }} GUI
run: |
dotnet publish UndertaleModTool -c ${{ matrix.configuration }} -r win-x64 -p:DefineConstants="SHOW_COMMIT_HASH" --self-contained ${{ matrix.bundled }} -p:PublishSingleFile=${{ matrix.singlefile }} --output ${{ matrix.os }}
dotnet publish UndertaleModToolUpdater -c ${{ matrix.configuration }} -r win-x64 --self-contained ${{ matrix.bundled }} -p:PublishSingleFile=false --output ${{ matrix.os }}/Updater
- name: Copy external files
run: |
cp ./README.md ./${{ matrix.os }}
cp ./SCRIPTS.md ./${{ matrix.os }}
cp ./LICENSE.txt ./${{ matrix.os }}
- name: Create zip for nightly release Windows GUI
run: |
7z a -tzip GUI-${{ matrix.os }}-${{ matrix.configuration }}-isBundled-${{ matrix.bundled }}-isSingleFile-${{ matrix.singlefile }}.zip ./${{ matrix.os }}/* -mx0
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: GUI-${{ matrix.os }}-${{ matrix.configuration }}-isBundled-${{ matrix.bundled }}-isSingleFile-${{ matrix.singlefile }}
path: GUI-${{ matrix.os }}-${{ matrix.configuration }}-isBundled-${{ matrix.bundled }}-isSingleFile-${{ matrix.singlefile }}.zip
build_cli:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
configuration: [Debug]
bundled: [true]
include:
- os: ubuntu-latest
rid: linux-x64
- os: macOS-latest
rid: osx-x64
- os: windows-latest
rid: win-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore UndertaleModCli
- name: Build
run: dotnet build UndertaleModCli --no-restore
- name: Publish ${{ matrix.os }} CLI
run: dotnet publish UndertaleModCli -c ${{ matrix.configuration }} -r ${{ matrix.rid }} --self-contained ${{ matrix.bundled }} -p:PublishSingleFile=false --output CLI-${{ matrix.os }}
- name: Copy external files
run: |
cp ./README.md ./CLI-${{ matrix.os }}/
cp ./LICENSE.txt ./CLI-${{ matrix.os }}/
- name: Create zip for nightly release CLI
run: |
7z a -tzip CLI-${{ matrix.os }}-${{ matrix.configuration }}-isBundled-${{ matrix.bundled }}.zip ./CLI-${{ matrix.os }}/* -mx0
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: CLI-${{ matrix.os }}-${{ matrix.configuration }}-isBundled-${{ matrix.bundled }}
path: CLI-${{ matrix.os }}-${{ matrix.configuration }}-isBundled-${{ matrix.bundled }}.zip
upload:
needs: [build_gui, build_cli]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Delete tag and release
uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: bleeding-edge # tag name to delete
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: bleeding-edge
name: Bleeding Edge
prerelease: true
fail_on_unmatched_files: true
files: |
*/*
body: |
This is an automatically updating **bleeding edge** build of UndertaleModTool. There *will* be bugs! If you encounter any, please make an issue on GitHub or join the Underminers Discord for more help!
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check and fix the release
uses: actions/github-script@v7
with:
script: |
// Wait 10 seconds
await new Promise(r => setTimeout(r, 10000));
const {owner, repo} = context.repo;
const listReleasesResponse = await github.rest.repos.listReleases({
owner,
repo
});
if (listReleasesResponse.status !== 200)
throw new Error("Error listing releases");
let release_id;
for (let release of listReleasesResponse.data) {
if (release.tag_name !== "bleeding-edge")
continue;
console.log(release);
if (!release.draft) {
console.log("Found published bleeding edge release - no need to do anything.");
return;
}
if (release_id == undefined)
release_id = release.id;
}
if (release_id == undefined)
throw new Error("The bleeding edge release was not found.");
console.warn("Found the bleeding edge release that is draft.\nTrying to publish...");
try {
await github.rest.repos.updateRelease({owner, repo, release_id, draft: false});
}
catch (err) {
if ('status' in err && err.status == 422) {
console.log('A non-draft release already exists?');
console.error(err);
return;
}
else
throw err;
}
console.log("The draft release was published successfully.");