-
Notifications
You must be signed in to change notification settings - Fork 155
178 lines (158 loc) · 5.93 KB
/
windows-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
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
# vim: tabstop=2 shiftwidth=2
name: Build EDMC
on:
push:
tags:
- "Release/*"
workflow_dispatch:
jobs:
variables:
outputs:
sem_ver: ${{ steps.var.outputs.sem_ver }}
short_sha: ${{ steps.var.outputs.short_sha }}
runs-on: "ubuntu-latest"
steps:
- name: Setting global variables
uses: actions/github-script@v7
id: var
with:
script: |
core.setOutput('sem_ver', '${{ github.ref_name }}'.replaceAll('Release\/', ''))
core.setOutput('short_sha', '${{ github.sha }}'.substring(0, 8))
linux_build:
needs: [variables]
name: Linux environment build steps
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Create .gitversion
run: |
echo "${{ needs.variables.outputs.short_sha }}" > .gitversion
- name: Make tar archive
run: |
# For 'tar' we can only specify filename/glob exclusions, not any
# directory location
tar -c -v -z \
-f ../EDMarketConnector-release-${{ needs.variables.outputs.sem_ver }}.tar.gz \
-C .. \
--exclude=EDMarketConnector-release-*.* \
--exclude=.editorconfig \
--exclude=.flake8 \
--exclude=.gitattributes \
--exclude=.gitignore \
--exclude=.gitmodules \
--exclude=.git \
--exclude=.github \
--exclude=.mypy.ini \
--exclude=.pre-commit-config.yaml \
--exclude=build.py \
--exclude=*.manifest \
--exclude=coriolis-data \
--exclude=img \
--exclude=pyproject.toml \
--exclude=scripts \
--exclude=tests \
EDMarketConnector
mv ../EDMarketConnector-release-${{ needs.variables.outputs.sem_ver }}.tar.gz .
- name: Upload build files
uses: actions/upload-artifact@v4
with:
name: built-files-linux
path: |
EDMarketConnector-release-*.tar.gz
windows_build:
needs: [variables]
name: Build EDMC
runs-on: windows-latest
defaults:
run:
shell: powershell
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Make zip archive
uses: thedoctor0/zip-release@main
with:
type: 'zip'
# We want an in-zip prefix of `EDMarketConnector/` for all files, so
# we specify that:
# 1. We work from the parent directory
directory: '..'
# 2. The path we're using is the 'root' directory
path: 'EDMarketConnector'
# 3. The .zip file has to be in the 'root' so that upload-artifact
# will process it. Can't use relative paths.
filename: 'EDMarketConnector/EDMarketConnector-release-${{ needs.variables.outputs.sem_ver }}.zip'
# 4. And all the exclusions need to be prefixed with the 'root'
# directory.
# NB: If this gets too long it can cause zip 'Command Line Error',
# presumably due to a Windows CL length limit.
exclusions: 'EDMarketConnector/EDMarketConnector-release-*.* EDMarketConnector/.editorconfig EDMarketConnector/.flake8 EDMarketConnector/.git* EDMarketConnector/.mypy.ini EDMarketConnector/.pre-commit-config.yaml EDMarketConnector/build.py EDMarketConnector/*.manifest EDMarketConnector/coriolis-data/ EDMarketConnector/img/ EDMarketConnector/pyproject.toml EDMarketConnector/scripts/ EDMarketConnector/tests/'
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
architecture: "x86"
cache: 'pip' # caching pip dependencies
- name: Install python tools
run: |
pip install wheel
pip install -r requirements-dev.txt
- name: Download winsparkle
run: |
Invoke-Webrequest -UseBasicParsing https://github.com/vslavik/winsparkle/releases/download/v0.8.1/WinSparkle-0.8.1.zip -OutFile out.zip
Expand-Archive out.zip
Move-Item 'out\WinSparkle-0.8.1\Release\*' '.\'
- name: Build EDMC
run: |
python build.py
- name: InnoSetup
uses: nadeemjazmawe/[email protected]
with:
filepath: './EDMC_Installer_Config.iss'
- name: Rename Installer
run: |
Get-ChildItem -Path . -Filter "EDMarketConnector_Installer_*.exe" | Rename-Item -NewName {"EDMarketConnector_Installer_Unsigned_$($_.Name -replace '^EDMarketConnector_Installer_', '')"}
- name: Upload build files
uses: actions/upload-artifact@v4
with:
name: built-files-windows
path: |
EDMarketConnector_Installer_*.exe
EDMarketConnector-release-*.zip
Merge:
runs-on: ubuntu-latest
needs: [ windows_build, linux_build ]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: Built files
pattern: built-files-*
release:
name: Release new version
runs-on: ubuntu-latest
needs: Merge
if: "${{ github.event_name != 'workflow_dispatch' }}"
steps:
- name: Download binary
uses: actions/download-artifact@v4
with:
name: Built files
path: ./
- name: Hash files
run: sha256sum EDMarketConnector_Installer_*.exe EDMarketConnector-release-*.{zip,tar.gz} > ./hashes.sum
- name: Create Draft Release
uses: "softprops/action-gh-release@v2"
with:
token: "${{secrets.GITHUB_TOKEN}}"
draft: true
prerelease: true
discussion_category_name: "Announcement"
files: |
./EDMarketConnector_Installer_*.exe
./EDMarketConnector-release-*.zip
./EDMarketConnector-release-*.tar.gz
./hashes.sum