-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (110 loc) · 5.3 KB
/
Copy pathrelease.yml
File metadata and controls
119 lines (110 loc) · 5.3 KB
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
name: Release
# Triggered by pushing a version tag `published-vX.Y.Z` (done manually after the
# release PR is merged — see the `release` skill). Builds the deliverable and
# publishes a GitHub Release with CTLD.lua attached.
on:
push:
tags: ['published-v*']
jobs:
release:
name: Publish GitHub Release
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install ctld-tools (the build regenerates CTLD_config_defaults.lua via gen-config)
working-directory: tools/ctld-tools
shell: bash
run: |
pip install poetry
# gen-config needs lupa, a build-time dep in the dev group; keep dev, drop build.
poetry install --without build
- name: Build CTLD.lua
run: powershell -ExecutionPolicy Bypass -File tools\build\merge_CTLD.ps1
shell: pwsh
- name: Build the dev-time asset-check companion
run: powershell -ExecutionPolicy Bypass -File tools\companion\build_companion.ps1
shell: pwsh
- name: Resolve version from tag
id: ver
run: |
$tag = "${{ github.ref_name }}" # e.g. published-v2.0.0 or published-v2.0.0-rc1
$version = $tag -replace '^published-v', ''
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
# A semver pre-release suffix (a '-' in the version, e.g. -rc1) marks a pre-release:
# publish it as such and leave the published-latest floating tag untouched.
$prerelease = if ($version -match '-') { 'true' } else { 'false' }
"prerelease=$prerelease" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
shell: pwsh
- name: Create GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
notes=(--generate-notes)
[ -f RELEASE_NOTES.md ] && notes=(--notes-file RELEASE_NOTES.md)
# rc-suffixed versions publish as a GitHub pre-release (not the default "Latest").
pre=()
[ "${{ steps.ver.outputs.prerelease }}" = "true" ] && pre=(--prerelease)
gh release create "${{ github.ref_name }}" \
CTLD.lua dist/CTLD_userConfig.lua dist/CTLD_asset_check.lua \
--title "CTLD v${{ steps.ver.outputs.version }}" \
"${notes[@]}" "${pre[@]}"
# A floating "published-latest" tag tracks the last STABLE release. Only a real
# release advances it; a pre-release (rc) leaves production users on the previous
# stable. "published-latest" is not matched by the 'published-v*' trigger, so this
# push does not re-trigger the workflow.
- name: Advance published-latest (stable only)
if: steps.ver.outputs.prerelease != 'true'
run: |
git tag -f published-latest "${{ github.ref_name }}"
git push origin -f published-latest
shell: pwsh
# ─────────────────────────────────────────────────────────────
# Build the Mission Maker tool ctld-tools.exe (PyInstaller) and attach it to the
# release. The exe bundles textual (the TUI), the embedded reference bundle and the
# DCS type set — but NOT lupa: the reference is committed data resolved without it,
# so we install without the dev group (lupa lives there) and exclude the module.
# Separate job: if packaging fails, the CTLD.lua release (job above) is already
# published — only the exe is missing.
# ─────────────────────────────────────────────────────────────
build-exe:
name: Build & attach ctld-tools.exe
needs: release
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Build ctld-tools.exe
working-directory: tools/ctld-tools
shell: bash
run: |
pip install poetry
# --without dev drops lupa (build-time only); --with build adds pyinstaller.
poetry install --without dev --with build
poetry run pyinstaller --onefile --name ctld-tools \
--collect-all textual \
--exclude-module lupa \
--add-data "ctld_tools/data/dcs_types.json;ctld_tools/data" \
--add-data "ctld_tools/data/reference.json;ctld_tools/data" \
--add-data "ctld_tools/data/locales;ctld_tools/data/locales" \
ctld_tools/__main__.py
- name: Smoke-check the exe (lists the tui command, runs without lupa)
working-directory: tools/ctld-tools
shell: bash
run: |
./dist/ctld-tools.exe --help | grep -q " tui " || { echo "::error::tui command missing from exe"; exit 1; }
./dist/ctld-tools.exe tui --help | grep -qi "interactive" || { echo "::error::tui --help failed"; exit 1; }
- name: Attach ctld-tools.exe to the release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.ref_name }}" tools/ctld-tools/dist/ctld-tools.exe