-
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (112 loc) · 4.43 KB
/
build.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
name: Build
on:
workflow_dispatch:
inputs:
latest:
description: 'Update latest release'
required: true
default: false
type: boolean
overwrite:
description: 'Overwrite file on upload'
required: true
default: false
type: boolean
prerelease:
description: 'Update PreRelease'
required: true
default: false
type: boolean
release:
description: 'Release'
required: true
default: false
type: boolean
release_mode:
description: 'Release Mode'
required: true
default: false
type: boolean
push:
branches: ["main"]
pull_request:
branches: ["main"]
release:
types: [created]
env:
CARGO_TERM_COLOR: always
jobs:
build:
permissions: write-all
runs-on: windows-2022
steps:
# attempt to increase windows runner speed
# https://github.com/actions/runner-images/issues/7320#issuecomment-1477640384
- run: Set-MpPreference -DisableRealtimeMonitoring $true
shell: powershell
- name: Checkout
uses: actions/checkout@v4
- name: Install just
uses: baptiste0928/cargo-install@v3
with:
crate: just
- name: Install cargo-target-dir
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-target-dir
git: https://github.com/MolotovCherry/cargo-target-dir
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ (github.event_name == 'release' || inputs.release_mode || inputs.release) && 'prod' || 'dev' }}
- name: Build Release
if: github.event_name == 'release' || inputs.release_mode || inputs.release
run: just build-release
- name: Build Debug
if: github.event_name != 'release' && !(inputs.release_mode || inputs.release)
env:
CARGO_INCREMENTAL: 1
run: just build-ci
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build
path: |
target/*/*.exe
target/*/*.dll
target/*/*.pdb
- name: Create staging folders
if: github.event_name == 'release' || inputs.release
run: |
New-Item -ItemType Directory -Force -Path _staging-watcher/bin
New-Item -ItemType Directory -Force -Path _staging-injector/bin
New-Item -ItemType Directory -Force -Path _staging-autostart/bin
New-Item -ItemType Directory -Force -Path _staging-debug
- name: Zip files up
if: github.event_name == 'release' || inputs.release
run: |
# watcher
Get-ChildItem -Path target/*/*watcher.exe,target/*/loader.dll,assets/*,assets-watcher/* | Copy-Item -Destination "_staging-watcher/bin"
Compress-Archive -Path "_staging-watcher/bin" -CompressionLevel Optimal -DestinationPath "yet-another-bg3-native-mod-loader-watcher-x64.zip"
# injector
Get-ChildItem -Path target/*/*injector.exe,target/*/loader.dll,assets/*,assets-injector/* | Copy-Item -Destination "_staging-injector/bin"
Compress-Archive -Path "_staging-injector/bin" -CompressionLevel Optimal -DestinationPath "yet-another-bg3-native-mod-loader-injector-x64.zip"
# autostart
Get-ChildItem -Path target/*/*autostart*.exe,target/*/loader.dll,assets/*,assets-autostart/* | Copy-Item -Destination "_staging-autostart/bin"
Compress-Archive -Path "_staging-autostart/bin" -CompressionLevel Optimal -DestinationPath "yet-another-bg3-native-mod-loader-autostart-x64.zip"
# debug symbols
Get-ChildItem -Path target/*/*.pdb,assets-dbg/* | Copy-Item -Destination "_staging-debug"
$files = Get-ChildItem -Path _staging-debug/*
Compress-Archive -CompressionLevel Optimal -Path $files.FullName -DestinationPath "yet-another-bg3-native-mod-loader-dbg-symbols-x64.zip"
- name: Attach assets to release
if: github.event_name == 'release' || inputs.release
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "*.zip"
draft: false
update_latest_release: ${{ inputs.latest }}
overwrite: ${{ inputs.overwrite }}
prerelease: ${{ inputs.prerelease }}
release_id: ${{ github.event_name == 'release' && github.event.release.id || 0 }}