-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (111 loc) · 4.62 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
name: Nightly Release
on:
# This can be used to automatically publish nightlies at UTC nighttime
schedule:
- cron: '0 3 * * *' # run at 3 AM UTC
# This can be used to allow manually triggering nightlies from the web interface
workflow_dispatch:
jobs:
date-check:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
build:
needs: date-check
if: ${{ needs.date-check.outputs.should_run != 'false' }}
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
runs-on: windows-latest
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set Work ENVs
id: vars
run: |
echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M')"
echo "::set-output name=body::$(git log master --since='24 hours ago' | sed -En 's/^ +?([a-z]+:\w*)/\1/p')"
WIN_HOME=$(echo $HOME | tr '/' '\\')
WIN_HOME="${WIN_HOME:1:1}:${WIN_HOME:2:${#WIN_HOME}-1}"
WIN_HOME=${WIN_HOME^}
echo $WIN_HOME
echo DX9_SDK=$WIN_HOME/dx9
echo "DX9_SDK=$WIN_HOME/dx9" >> $GITHUB_ENV
shell: bash
- run: vcpkg integrate install
- uses: ilammy/[email protected]
with:
arch: x86
- name: "Install Inno"
run: choco install innosetup --acceptlicense
- name: "Restore DX9 Cache"
id: dx9-cache
uses: actions/cache@v4
with:
path: ~/dx9
key: dx9-cache
- name: "Restore HD Installer"
id: hde-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/Installer/Assets/External
key: hde-cache
- name: "Cache DX9 SDK"
if: steps.dx9-cache.outputs.cache-hit != 'true'
run: |
echo Downloading DXSDK June 2010
curl -s -L -o "_DX2010_.exe" "https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe"
echo Extracting include files
7z x _DX2010_.exe DXSDK/Include -o_DX2010_ > nul
echo Extracting lib files
7z x _DX2010_.exe DXSDK/Lib/x86 -o_DX2010_ > nul
echo Moving SDK to home directory
mkdir $DX9_SDK
mv _DX2010_/DXSDK/* $DX9_SDK
echo Cleaning up install files
rm -fR _DX*_ _DX*_.exe
shell: bash
- name: "Download HDE Installer"
if: steps.hde-cache.outputs.cache-hit != 'true'
run:
curl -s -o ${{ github.workspace }}/Installer/Assets/External/FreelancerHDESetup_v06_silent_test.exe https://f003.backblazeb2.com/b2api/v2/b2_download_file_by_id?fileId=4_z0d41f4d9e10a9adf85d20013_f212668fac620798a_d20240305_m125353_c003_v0312019_t0022_u01709643233941
- name: Compile ChaosMod
run: msbuild.exe "${env:GITHUB_WORKSPACE}\FreelancerChaosMod.sln" /t:Build /p:Configuration=Release /p:Platform=x86
- name: "Pre-Build Installer"
run: |
cd ${{ github.workspace }}
mkdir Archive
Get-ChildItem -Path ".\Assets" | Move-Item -Destination ".\Archive"
Get-ChildItem -Path ".\Release" -Filter ".dll" -Recurse | Move-Item -Destination ".\Archive\EXE"
7z a -r ./chaosmod.7z ./Archive/*
Copy-Item -Path .\chaosmod.7z -Destination ./Installer/Assets/Mod
- name: "Build Installer"
run: |
cd ${{ github.workspace }}/Installer
& "${env:programfiles(x86)}\Inno Setup 6\iscc.exe" /O+ ".\setup.iss"
cd ..
7z a -r .\Installer.7z .\Installer/Output*
Rename-Item -Path .\chaosmod.7z -NewName Assets.7z
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.workspace }}/*.7z"
body: "${{ steps.vars.outputs.body }}"
tag: ${{ steps.vars.outputs.date }}