generated from YimMenu/YimMenuV2
-
Notifications
You must be signed in to change notification settings - Fork 38
162 lines (137 loc) · 5.13 KB
/
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
name: Nightly Build
on:
schedule:
# cronjob that triggers every day at 2PM UTC
- cron: "0 14 * * *"
workflow_dispatch:
concurrency:
group: nightly
cancel-in-progress: true
jobs:
check_recent_commit:
runs-on: ubuntu-latest
name: Check Recent Commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v3
- id: should_run
name: Check if latest commit date is within the previous 24 hours
run: |
if [ -z "$(git rev-list --since="24 hours ago" --all)" ]; then
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "should_run=true" >> $GITHUB_OUTPUT
fi
build_nightly:
runs-on: [self-hosted, Windows]
name: Build Nightly
needs: check_recent_commit
if: needs.check_recent_commit.outputs.should_run == 'true'
outputs:
full_sha: ${{ steps.var.outputs.full_sha }}
short_sha: ${{ steps.var.outputs.short_sha }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Check CMake version
run: cmake --version
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Generate CMake project
run: cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D OPTIMIZE=YES -S. -Bbuild -G Ninja
- name: Build 64bit release DLL
run: cmake --build ./build --config RelWithDebInfo --target HorseMenu --
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: binary
path: |
build/HorseMenu.dll
build/HorseMenu.pdb
- name: Generate Build Info
id: var
run: |
echo "full_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
echo "short_sha=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT
recreate_release:
runs-on: ubuntu-latest
name: Recreate Release
needs: build_nightly
if: needs.check_recent_commit.outputs.should_run == 'true'
steps:
- uses: actions/checkout@v3
- name: Delete Existing Release
id: delete_release
uses: actions/github-script@v6
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag = "nightly";
// List all releases and find the release by tag
const releases = await github.rest.repos.listReleases({
owner: owner,
repo: repo,
});
const release = releases.data.find(release => release.tag_name === tag);
// Check if the release exists and delete it
if (release) {
await github.rest.repos.deleteRelease({
owner: owner,
repo: repo,
release_id: release.id,
});
console.log(`Deleted release with ID ${release.id}`);
} else {
console.log("No existing release to delete");
}
// Delete the tag
try {
await github.rest.git.deleteRef({
owner: owner,
repo: repo,
ref: `tags/${tag}`,
});
console.log(`Deleted tag ${tag}`);
} catch (error) {
console.error(`Error deleting tag: ${error.message}`);
}
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: binary
- name: Echo build sha256
id: build_sha
run: |
sha256sum HorseMenu.dll > sha256.checksum
echo "build_sha=$(cat sha256.checksum)" >> $GITHUB_OUTPUT
cat sha256.checksum
- name: Nightly Release
uses: softprops/action-gh-release@v1
with:
name: Nightly [${{ needs.build_nightly.outputs.short_sha }}]
tag_name: nightly
body: |
**This release has been built by Github Actions**
[Link to build](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
Build SHA256:
```
${{ steps.build_sha.outputs.build_sha }}
```
To verify the build SHA256 during the action, click the build link, go-to "Create Release", open the Echo build sha256 step and read the sha256.
You can download the build artifacts, generate a SHA256 checksum and compare it with the below binary.
Build artifacts ARE NOT automatically the same as release assets since release assets can be modified afterwards.
These are nightly builds of HorseMenu, they are provided for testing purposes only:
- Test if your build environment produces a broken HorseMenu.dll
- Test if source code is out of date and no longer compatible with the current version of Red Dead Redemption 2
If you wish to use this menu as-is you are on your own, no warranty is provided.
Full Commit Hash:
```
${{ needs.build_nightly.outputs.full_sha }}
```
files: |
HorseMenu.dll