Skip to content

Commit 2e9bd21

Browse files
ci: setup releases (#4)
1 parent 919f923 commit 2e9bd21

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,31 @@ env:
1717
PYTHON_VERSION: '3.14'
1818

1919
jobs:
20+
setup_release:
21+
name: Setup Release
22+
outputs:
23+
publish_release: ${{ steps.setup_release.outputs.publish_release }}
24+
release_body: ${{ steps.setup_release.outputs.release_body }}
25+
release_commit: ${{ steps.setup_release.outputs.release_commit }}
26+
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
27+
release_tag: ${{ steps.setup_release.outputs.release_tag }}
28+
release_version: ${{ steps.setup_release.outputs.release_version }}
29+
permissions:
30+
contents: write
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
35+
36+
- name: Setup Release
37+
id: setup_release
38+
uses: LizardByte/actions/actions/release_setup@200eaeb897a2b065a65cb6f16b41077432007490 # v2026.605.34721
39+
with:
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
2042
build:
2143
name: Build (${{ matrix.name }})
44+
needs: setup_release
2245
permissions:
2346
contents: read
2447
runs-on: ${{ matrix.os }}
@@ -172,7 +195,10 @@ jobs:
172195
- name: Configure
173196
if: matrix.kind != 'msvc'
174197
env:
198+
BRANCH: ${{ github.head_ref || github.ref_name }}
199+
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
175200
CC: ${{ matrix.cc }}
201+
COMMIT: ${{ needs.setup_release.outputs.release_commit }}
176202
CXX: ${{ matrix.cxx }}
177203
run: |
178204
cmake \
@@ -186,6 +212,10 @@ jobs:
186212
187213
- name: Configure MSVC
188214
if: matrix.kind == 'msvc'
215+
env:
216+
BRANCH: ${{ github.head_ref || github.ref_name }}
217+
BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }}
218+
COMMIT: ${{ needs.setup_release.outputs.release_commit }}
189219
run: |
190220
cmake `
191221
-DBUILD_DOCS=OFF `
@@ -393,3 +423,70 @@ jobs:
393423
flags: ${{ matrix.flag }}
394424
token: ${{ secrets.CODECOV_TOKEN }}
395425
verbose: true
426+
427+
release:
428+
name: Release
429+
if: >-
430+
always() &&
431+
needs.setup_release.outputs.publish_release == 'true' &&
432+
needs.build.result == 'success' &&
433+
startsWith(github.repository, 'LizardByte/')
434+
needs:
435+
- build
436+
- setup_release
437+
permissions:
438+
contents: read
439+
runs-on: ubuntu-latest
440+
steps:
441+
- name: Download install artifact (Linux-GCC)
442+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
443+
with:
444+
name: install-Linux-GCC
445+
path: install-Linux-GCC
446+
447+
- name: Download install artifact (Linux-Clang)
448+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
449+
with:
450+
name: install-Linux-Clang
451+
path: install-Linux-Clang
452+
453+
- name: Download install artifact (macOS)
454+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
455+
with:
456+
name: install-macOS
457+
path: install-macOS
458+
459+
- name: Download install artifact (Windows-MinGW-UCRT64)
460+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
461+
with:
462+
name: install-Windows-MinGW-UCRT64
463+
path: install-Windows-MinGW-UCRT64
464+
465+
- name: Download install artifact (Windows-MSVC)
466+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
467+
with:
468+
name: install-Windows-MSVC
469+
path: install-Windows-MSVC
470+
471+
- name: Package install artifacts
472+
run: |
473+
mkdir -p artifacts
474+
for name in Linux-GCC Linux-Clang macOS Windows-MinGW-UCRT64 Windows-MSVC; do
475+
zip -r \
476+
"artifacts/libvirtualhid-${{ needs.setup_release.outputs.release_tag }}-${name}.zip" \
477+
"install-${name}"
478+
done
479+
480+
- name: Create/Update GitHub Release
481+
if: needs.setup_release.outputs.publish_release == 'true'
482+
uses: LizardByte/actions/actions/release_create@200eaeb897a2b065a65cb6f16b41077432007490 # v2026.605.34721
483+
with:
484+
allowUpdates: false
485+
body: ${{ needs.setup_release.outputs.release_body }}
486+
draft: true
487+
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
488+
name: ${{ needs.setup_release.outputs.release_tag }}
489+
prerelease: true
490+
tag: ${{ needs.setup_release.outputs.release_tag }}
491+
token: ${{ secrets.GH_BOT_TOKEN }}
492+
virustotal_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}

0 commit comments

Comments
 (0)