-
Notifications
You must be signed in to change notification settings - Fork 40
198 lines (181 loc) · 5.49 KB
/
build.yaml
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Build
on:
push:
branches: [main]
tags:
- v*
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: ${{ matrix.os.name }}
runs-on: ${{ matrix.os.runner }}
strategy:
fail-fast: false
matrix:
os:
- runner: ubuntu-latest
name: ubuntu
artifact: linux-x64
exe: hemtt
- runner: windows-latest
name: windows
artifact: windows-x64
exe: hemtt.exe
# Intel Mac
- runner: macos-13
name: macos-x64
artifact: macos-x64
exe: hemtt
# ARM Mac
- runner: macos-latest
name: macos-arm
artifact: macos-arm64
exe: hemtt
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: echo "RELEASE=true" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/') && matrix.os.name == 'ubuntu'
- run: echo "RELEASE=true" >> $env:GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/') && matrix.os.name == 'windows'
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: build-${{ matrix.os.name }}
- name: Compile
run: cargo build --release
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os.artifact }}
path: target/release/${{ matrix.os.exe }}
mods:
name: ${{ matrix.os.name }} / ${{ matrix.mod.repo }}
runs-on: ${{ matrix.os.runner }}
needs:
- build
strategy:
fail-fast: false
matrix:
os:
- runner: ubuntu-latest
name: ubuntu
artifact: linux-x64
- runner: windows-latest
name: windows
artifact: windows-x64
mod:
- repo: CBATeam/CBA_A3
commit: b99dddf46aca7cea008bca56f5a553c5d7776219
- repo: acemod/ACE3
commit: eb57fa49c404e662abcd18c7e52c1f7c4b67a9b0
- repo: IDI-Systems/acre2
commit: e5c1bba58b63e18d03721a68d32efd39748af551
- repo: ArmaForces/Mods
commit: 79d21ac395d16cb7ed1ed556b0da4cbc67af98c9
- repo: Theseus-Aegis/Mods
commit: 943906d18817a7f0829742f0c91cdad34456c594
- repo: SynixeContractors/Mod
commit: b04fb1ea3a291366017026e2ec94f95a0f28eb8b
steps:
- name: Download HEMTT
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os.artifact }}
path: hemtt
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ matrix.mod.repo }}
path: mod
ref: ${{ matrix.mod.commit }}
- name: Install Linux & MacOS
if: startsWith(matrix.os.runner, 'ubuntu') || startsWith(matrix.os.runner, 'macos')
run: |
cd hemtt && cp hemtt /usr/local/bin/hemtt && chmod +x /usr/local/bin/hemtt
- name: Install Windows
if: startsWith(matrix.os.runner, 'windows')
run: |
cd hemtt && copy hemtt.exe C:\Windows\System32\hemtt.exe
- name: Run `hemtt dev` on ${{ matrix.mod.repo }}
run: |
cd mod && hemtt dev
- name: Install Arma 3 Tools
uses: arma-actions/arma3-tools@master
with:
toolsUrl: ${{ secrets.ARMA3_TOOLS_URL }}
- name: Run `hemtt build` on ${{ matrix.mod.repo }}
run: |
cd mod && hemtt build
release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Linux x64
uses: actions/download-artifact@v4
with:
name: linux-x64
path: release
- name: Zip Linux x64
run: |
cd release && zip linux-x64.zip hemtt
- name: Rename Linux x64
run: |
cd release && mv hemtt linux-x64
- name: Download Windows x64
uses: actions/download-artifact@v4
with:
name: windows-x64
path: release
- name: Zip Windows x64
run: |
cd release && zip windows-x64.zip hemtt.exe && rm hemtt.exe
- name: Download MacOS x64
uses: actions/download-artifact@v4
with:
name: macos-x64
path: release
- name: Zip MacOS x64
run: |
cd release && zip macos-x64.zip hemtt
- name: Rename MacOS x64
run: |
cd release && mv hemtt darwin-x64
- name: Download MacOS ARM64
uses: actions/download-artifact@v4
with:
name: macos-arm64
path: release
- name: Rename MacOS ARM64
run: |
cd release && mv hemtt darwin-arm64
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
release/*
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winget:
needs:
- release
runs-on: windows-latest
steps:
# Requires forked winget-pkgs: https://github.com/microsoft/winget-pkgs to the same account as this project
- name: Submit to WinGet
uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: BrettMayson.HEMTT
installers-regex: 'windows-x64.zip'
token: ${{ secrets.WINGET_TOKEN }} # Classic Personal Access Token with [public_repo, workflow] scopes