|
| 1 | +# Tag release: reusable Build (cmt-workflow artifacts) → Inno Setup (Windows) → zip (macOS) → GitHub Release. |
| 2 | +# Local packaging: cmake --preset package-windows && cmake --build --preset inno-installer (see DEVELOPMENT.md, CMakeUserPresets.json). |
| 3 | + |
| 4 | +name: Package |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: package-${{ github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + name: Build (reusable) |
| 21 | + uses: ./.github/workflows/build.yml |
| 22 | + secrets: inherit |
| 23 | + with: |
| 24 | + ref: ${{ github.ref }} |
| 25 | + |
| 26 | + package-windows: |
| 27 | + needs: build |
| 28 | + runs-on: windows-latest |
| 29 | + defaults: |
| 30 | + run: |
| 31 | + shell: bash |
| 32 | + steps: |
| 33 | + - name: Checkout (resources for installer) |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + ref: ${{ github.ref }} |
| 37 | + submodules: recursive |
| 38 | + |
| 39 | + - name: Download Windows build artifacts |
| 40 | + uses: actions/download-artifact@v4 |
| 41 | + with: |
| 42 | + pattern: build-Windows-* |
| 43 | + path: ${{ github.workspace }}/_dl |
| 44 | + merge-multiple: false |
| 45 | + |
| 46 | + - name: Layout _build_msvc for installer_script.iss |
| 47 | + run: | |
| 48 | + set -euo pipefail |
| 49 | + for sdk in sdk_r20 sdk_r21 sdk_r23 sdk_r25 sdk_2023 sdk_2024 sdk_2025 sdk_2026; do |
| 50 | + mkdir -p "_build_msvc/${sdk}/bin/Release/plugins/mmdtool" |
| 51 | + src="_dl/build-Windows-${sdk}" |
| 52 | + if [ -d "$src" ]; then |
| 53 | + cp -R "$src"/* "_build_msvc/${sdk}/bin/Release/plugins/mmdtool/" |
| 54 | + else |
| 55 | + echo "Missing artifact: $src" >&2 |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | + done |
| 59 | +
|
| 60 | + - name: Install Inno Setup |
| 61 | + run: choco install innosetup -y |
| 62 | + |
| 63 | + - name: Compute version from tag |
| 64 | + id: ver |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + V="${GITHUB_REF_NAME#v}" |
| 68 | + echo "version=$V" >> "$GITHUB_OUTPUT" |
| 69 | +
|
| 70 | + - name: Run ISCC |
| 71 | + shell: bash |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | + ISCC="" |
| 75 | + for p in "/c/Program Files/Inno Setup 6/ISCC.exe" "/c/Program Files (x86)/Inno Setup 6/ISCC.exe"; do |
| 76 | + if [ -f "$p" ]; then ISCC="$p"; break; fi |
| 77 | + done |
| 78 | + if [ -z "$ISCC" ]; then echo "ISCC.exe not found" >&2; exit 1; fi |
| 79 | + "$ISCC" \ |
| 80 | + /DPluginVersion="${{ steps.ver.outputs.version }}" \ |
| 81 | + /DSdkBuildDir=_build_msvc \ |
| 82 | + /DSdkBinConfig=Release \ |
| 83 | + "${{ github.workspace }}/setup/Common/installer_script.iss" |
| 84 | +
|
| 85 | + - name: Upload installer artifact |
| 86 | + uses: actions/upload-artifact@v4 |
| 87 | + with: |
| 88 | + name: windows-installer |
| 89 | + path: setup/Common/Output/*.exe |
| 90 | + if-no-files-found: error |
| 91 | + |
| 92 | + package-macos: |
| 93 | + needs: build |
| 94 | + runs-on: macos-latest |
| 95 | + defaults: |
| 96 | + run: |
| 97 | + shell: bash |
| 98 | + steps: |
| 99 | + - name: Checkout (res/) |
| 100 | + uses: actions/checkout@v4 |
| 101 | + with: |
| 102 | + ref: ${{ github.ref }} |
| 103 | + submodules: recursive |
| 104 | + |
| 105 | + - name: Download macOS build artifacts |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + pattern: build-macOS-* |
| 109 | + path: ${{ github.workspace }}/_dl |
| 110 | + merge-multiple: false |
| 111 | + |
| 112 | + - name: Zip per-SDK plugin + matching res |
| 113 | + run: | |
| 114 | + set -euo pipefail |
| 115 | + mkdir -p dist |
| 116 | + res_for_sdk() { |
| 117 | + case "$1" in |
| 118 | + sdk_r20|sdk_r21|sdk_r23) echo "R20-S24" ;; |
| 119 | + *) echo "S24_up" ;; |
| 120 | + esac |
| 121 | + } |
| 122 | + for sdk in sdk_r20 sdk_r21 sdk_r23 sdk_r25 sdk_2023 sdk_2024 sdk_2025 sdk_2026; do |
| 123 | + src="_dl/build-macOS-${sdk}" |
| 124 | + if [ ! -d "$src" ]; then echo "Missing $src" >&2; exit 1; fi |
| 125 | + res_dir="res/$(res_for_sdk "$sdk")" |
| 126 | + rm -rf "pkg/${sdk}" |
| 127 | + mkdir -p "pkg/${sdk}/mmdtool" |
| 128 | + cp -R "$src"/* "pkg/${sdk}/mmdtool/" |
| 129 | + cp -R "$res_dir" "pkg/${sdk}/mmdtool/res" |
| 130 | + (cd "pkg/${sdk}" && zip -r "${{ github.workspace }}/dist/MMD_Tool_${sdk}_macOS.zip" mmdtool) |
| 131 | + done |
| 132 | +
|
| 133 | + - name: Upload macOS zip artifacts |
| 134 | + uses: actions/upload-artifact@v4 |
| 135 | + with: |
| 136 | + name: macos-zips |
| 137 | + path: dist/*.zip |
| 138 | + if-no-files-found: error |
| 139 | + |
| 140 | + release: |
| 141 | + needs: [package-windows, package-macos] |
| 142 | + runs-on: ubuntu-latest |
| 143 | + steps: |
| 144 | + - name: Download installer |
| 145 | + uses: actions/download-artifact@v4 |
| 146 | + with: |
| 147 | + name: windows-installer |
| 148 | + path: ${{ github.workspace }}/assets |
| 149 | + |
| 150 | + - name: Download macOS zips |
| 151 | + uses: actions/download-artifact@v4 |
| 152 | + with: |
| 153 | + name: macos-zips |
| 154 | + path: ${{ github.workspace }}/assets |
| 155 | + |
| 156 | + - name: Create GitHub Release |
| 157 | + uses: softprops/action-gh-release@v2 |
| 158 | + with: |
| 159 | + tag_name: ${{ github.ref_name }} |
| 160 | + name: ${{ github.ref_name }} |
| 161 | + body: | |
| 162 | + ## Changelog |
| 163 | +
|
| 164 | + _Add release notes here._ |
| 165 | +
|
| 166 | + Built from commit `${{ github.sha }}`. |
| 167 | + files: | |
| 168 | + assets/*.exe |
| 169 | + assets/*.zip |
| 170 | + env: |
| 171 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments