forked from AppleDash/dashcdg
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (148 loc) · 5.12 KB
/
Copy pathrelease-sneakernet.yml
File metadata and controls
162 lines (148 loc) · 5.12 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
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
name: Build and Release Sneakernet Bundle
on:
workflow_dispatch:
inputs:
release_tag:
description: "Release tag to create/update (example: v0.1.0)"
required: true
release_name:
description: "Optional release name (defaults to tag)"
required: false
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-and-release:
runs-on: windows-latest
env:
ZIP_PATH: build/dist/dashcdg-windows-sneakernet.zip
SAMPLES_ZIP_PATH: build/dist/dashcdg-sample-tracks-mp3g.zip
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set release metadata
id: release_meta
shell: bash
run: |
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
tag="${{ github.event.inputs.release_tag }}"
name="${{ github.event.inputs.release_name }}"
if [[ -z "${name}" ]]; then
name="${tag}"
fi
else
tag="${GITHUB_REF_NAME}"
name="${GITHUB_REF_NAME}"
fi
echo "release_tag=${tag}" >> "${GITHUB_OUTPUT}"
echo "release_name=${name}" >> "${GITHUB_OUTPUT}"
- name: Set up MSYS2 toolchain
id: msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
git
make
zip
autoconf
automake
libtool
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-binutils
mingw-w64-x86_64-opus
mingw-w64-x86_64-portaudio
mingw-w64-x86_64-glew
mingw-w64-x86_64-freeglut
mingw-w64-i686-gcc
mingw-w64-i686-make
mingw-w64-i686-cmake
mingw-w64-i686-ninja
mingw-w64-i686-binutils
mingw-w64-i686-opus
mingw-w64-i686-portaudio
mingw-w64-i686-glew
mingw-w64-i686-freeglut
- name: Resolve MSYS2 root
shell: msys2 {0}
run: |
msys_root_win='${{ steps.msys2.outputs.msys2-location }}'
if [[ -z "${msys_root_win}" ]]; then
echo "msys2-location output is empty" >&2
exit 1
fi
msys_root_win="${msys_root_win//\\//}"
msys_root="$(cygpath -u -a "${msys_root_win}")"
if [[ "${msys_root}" == "/" ]]; then
msys_root="/."
fi
if [[ ! -d "${msys_root}/mingw64/bin" ]] || [[ ! -d "${msys_root}/mingw32/bin" ]]; then
echo "Resolved MSYS2 root is incomplete: ${msys_root}" >&2
exit 1
fi
echo "Resolved MSYS2 root: ${msys_root}"
{
echo "MSYS2_ROOT=${msys_root}"
echo "DASHCDG_MSYS2_ROOT=${msys_root}"
} >> "${GITHUB_ENV}"
- name: Fetch vendor sources
shell: msys2 {0}
run: |
export MSYS2_ROOT="${MSYS2_ROOT:-${DASHCDG_MSYS2_ROOT:-}}"
bash scripts/fetch_opus_portaudio_vendors.sh
- name: Build sneakernet dist bundle
shell: msys2 {0}
run: |
export MSYS2_ROOT="${MSYS2_ROOT:-${DASHCDG_MSYS2_ROOT:-}}"
rm -rf build/soxr-vendor build/soxr-vendor-mingw64 build/soxr-vendor-mingw32
DASHCDG_SNEAKENET_CLEAN=1 SKIP_P3_DISASM=1 bash scripts/build_windows_sneakernet_dist.sh
test -f "${ZIP_PATH}"
- name: Package sample MP3+G library (cdg/)
shell: msys2 {0}
run: |
export MSYS2_ROOT="${MSYS2_ROOT:-${DASHCDG_MSYS2_ROOT:-}}"
if [[ ! -d cdg ]] || [[ -z "$(ls -A cdg 2>/dev/null)" ]]; then
echo "cdg/ missing or empty — cannot build sample zip" >&2
exit 1
fi
mkdir -p build/dist
rm -f "${SAMPLES_ZIP_PATH}"
(cd cdg && zip -r -q "../${SAMPLES_ZIP_PATH}" .)
test -f "${SAMPLES_ZIP_PATH}"
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: dashcdg-windows-sneakernet
path: ${{ env.ZIP_PATH }}
if-no-files-found: error
- name: Upload sample tracks artifact
uses: actions/upload-artifact@v4
with:
name: dashcdg-sample-tracks-mp3g
path: ${{ env.SAMPLES_ZIP_PATH }}
if-no-files-found: error
- name: Ensure tag exists for manual release
if: github.event_name == 'workflow_dispatch'
shell: bash
run: |
tag="${{ steps.release_meta.outputs.release_tag }}"
if ! git ls-remote --exit-code --tags origin "refs/tags/${tag}" >/dev/null 2>&1; then
git tag "${tag}" "${GITHUB_SHA}"
git push origin "refs/tags/${tag}"
fi
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_meta.outputs.release_tag }}
name: ${{ steps.release_meta.outputs.release_name }}
files: |
${{ env.ZIP_PATH }}
${{ env.SAMPLES_ZIP_PATH }}
generate_release_notes: true