81 lines
2.5 KiB
YAML
81 lines
2.5 KiB
YAML
name: build
|
|
|
|
# Builds both architectures, publishes the two installable component packages as
|
|
# workflow artifacts, and — when a tag is pushed — turns them into a GitHub release.
|
|
# The SDK is fetched from foobar2000.org at build time (tools/setup_sdk.ps1) and the
|
|
# renderer sources are part of this repository (kernel/), so nothing else is needed.
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Fetch the foobar2000 SDK (target 1.5/1.6)
|
|
shell: pwsh
|
|
run: ./tools/setup_sdk.ps1 -TargetVersion 80
|
|
|
|
- name: Check the tag against the component version
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
shell: pwsh
|
|
run: |
|
|
$declared = (Select-String -Path src/main.cpp -Pattern '#define JOC_VERSION "([^"]+)"').Matches[0].Groups[1].Value
|
|
$tag = '${{ github.ref_name }}'
|
|
if ($tag -ne "v$declared") {
|
|
throw "the tag $tag does not match JOC_VERSION $declared; the release would be mislabelled"
|
|
}
|
|
|
|
- name: Build both architectures and package them
|
|
shell: pwsh
|
|
run: ./tools/package.ps1
|
|
|
|
- name: List the packages
|
|
shell: pwsh
|
|
run: Get-ChildItem dist -Filter *.fb2k-component | Select-Object Name, Length
|
|
|
|
- name: Upload the x86 component (foobar2000 1.6 and 2.x 32-bit)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: foo_input_joc-x86
|
|
path: dist/*-x86.fb2k-component
|
|
if-no-files-found: error
|
|
|
|
- name: Upload the x64 component (foobar2000 2.x 64-bit)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: foo_input_joc-x64
|
|
path: dist/*-x64.fb2k-component
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
# A pushed tag is what makes a release; branch builds only leave artifacts.
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs: windows
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Collect the packaged components
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: List what will be published
|
|
run: ls -l dist
|
|
|
|
- name: Create the release for this tag
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ github.ref_name }}
|
|
files: dist/*.fb2k-component
|
|
fail_on_unmatched_files: true
|
|
generate_release_notes: true
|