|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: [ 'v*' ] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + config: |
| 16 | + - platform: linux-x86_64 |
| 17 | + artifact: virtualjaguar_libretro.so |
| 18 | + os: ubuntu-latest |
| 19 | + cc: gcc |
| 20 | + cxx: g++ |
| 21 | + |
| 22 | + - platform: linux-aarch64 |
| 23 | + artifact: virtualjaguar_libretro.so |
| 24 | + os: ubuntu-24.04-arm |
| 25 | + cc: gcc |
| 26 | + cxx: g++ |
| 27 | + |
| 28 | + - platform: macos-arm64 |
| 29 | + artifact: virtualjaguar_libretro.dylib |
| 30 | + os: macos-latest |
| 31 | + cc: clang |
| 32 | + cxx: clang++ |
| 33 | + |
| 34 | + - platform: windows-x86_64 |
| 35 | + artifact: virtualjaguar_libretro.dll |
| 36 | + os: windows-latest |
| 37 | + cc: gcc |
| 38 | + cxx: g++ |
| 39 | + shell: 'msys2 {0}' |
| 40 | + |
| 41 | + name: build-${{ matrix.config.platform }} |
| 42 | + runs-on: ${{ matrix.config.os }} |
| 43 | + |
| 44 | + defaults: |
| 45 | + run: |
| 46 | + shell: ${{ matrix.config.shell || 'bash' }} |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Set up MSYS2 |
| 52 | + if: runner.os == 'Windows' |
| 53 | + uses: msys2/setup-msys2@v2 |
| 54 | + with: |
| 55 | + msystem: MINGW64 |
| 56 | + update: false |
| 57 | + install: >- |
| 58 | + mingw-w64-x86_64-gcc |
| 59 | + make |
| 60 | +
|
| 61 | + - name: Build |
| 62 | + run: make -j4 CC=${{ matrix.config.cc }} CXX=${{ matrix.config.cxx }} |
| 63 | + |
| 64 | + - name: Package |
| 65 | + run: | |
| 66 | + mkdir -p dist |
| 67 | + cp ${{ matrix.config.artifact }} dist/virtualjaguar_libretro-${{ matrix.config.platform }}${SUFFIX} |
| 68 | + env: |
| 69 | + SUFFIX: ${{ matrix.config.platform == 'windows-x86_64' && '.dll' || (matrix.config.platform == 'macos-arm64' && '.dylib' || '.so') }} |
| 70 | + |
| 71 | + - name: Upload artifact |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: virtualjaguar_libretro-${{ matrix.config.platform }} |
| 75 | + path: dist/ |
| 76 | + if-no-files-found: error |
| 77 | + |
| 78 | + release: |
| 79 | + needs: build |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v4 |
| 83 | + |
| 84 | + - name: Download all artifacts |
| 85 | + uses: actions/download-artifact@v4 |
| 86 | + with: |
| 87 | + path: artifacts/ |
| 88 | + |
| 89 | + - name: Create release |
| 90 | + env: |
| 91 | + GH_TOKEN: ${{ github.token }} |
| 92 | + run: | |
| 93 | + TAG="${GITHUB_REF_NAME}" |
| 94 | + # Collect all built binaries |
| 95 | + find artifacts/ -type f | sort |
| 96 | +
|
| 97 | + gh release create "${TAG}" \ |
| 98 | + --title "${TAG}" \ |
| 99 | + --generate-notes \ |
| 100 | + artifacts/virtualjaguar_libretro-*/* |
0 commit comments