|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-release: |
| 10 | + name: Build Release (${{ matrix.os }}) |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - name: Linux-x64 |
| 17 | + os: ubuntu-latest |
| 18 | + asset_pattern: "qb64pe_lnx-*.tar.gz" |
| 19 | + bin_name: Brainfuck64 |
| 20 | + archive_name: Brainfuck64-linux-x64.zip |
| 21 | + - name: Windows-x64 |
| 22 | + os: windows-latest |
| 23 | + asset_pattern: "qb64pe_win-x64-*.7z" |
| 24 | + bin_name: Brainfuck64.exe |
| 25 | + archive_name: Brainfuck64-windows-x64.zip |
| 26 | + - name: Windows-x86 |
| 27 | + os: windows-latest |
| 28 | + asset_pattern: "qb64pe_win-x86-*.7z" |
| 29 | + bin_name: Brainfuck64.exe |
| 30 | + archive_name: Brainfuck64-windows-x86.zip |
| 31 | + - name: Windows-arm64 |
| 32 | + os: windows-11-arm |
| 33 | + asset_pattern: "qb64pe_win-arm64-*.7z" |
| 34 | + bin_name: Brainfuck64.exe |
| 35 | + archive_name: Brainfuck64-windows-arm64.zip |
| 36 | + - name: macOS-x64 |
| 37 | + os: macos-latest |
| 38 | + asset_pattern: "qb64pe_osx-*.tar.gz" |
| 39 | + bin_name: Brainfuck64 |
| 40 | + archive_name: Brainfuck64-macos-x64.zip |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + submodules: recursive |
| 47 | + |
| 48 | + - name: Install dependencies (Linux) |
| 49 | + if: runner.os == 'Linux' |
| 50 | + run: | |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get install -y libasound2-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev libx11-dev libxext-dev zip |
| 53 | +
|
| 54 | + - name: Download QB64-PE |
| 55 | + env: |
| 56 | + GH_TOKEN: ${{ github.token }} |
| 57 | + run: | |
| 58 | + gh release download latest -R QB64-Phoenix-Edition/QB64pe -p "${{ matrix.asset_pattern }}" --dir qb64_dl |
| 59 | +
|
| 60 | + - name: Extract QB64-PE (Unix) |
| 61 | + if: runner.os != 'Windows' |
| 62 | + run: | |
| 63 | + mkdir qb64pe |
| 64 | + tar -xzf qb64_dl/*.tar.gz -C qb64pe --strip-components=1 |
| 65 | +
|
| 66 | + - name: Extract QB64-PE (Windows) |
| 67 | + if: runner.os == 'Windows' |
| 68 | + run: | |
| 69 | + 7z x qb64_dl/*.7z -oqb64pe |
| 70 | + $subFolder = Get-ChildItem -Path qb64pe -Directory | Select-Object -First 1 |
| 71 | + if ($subFolder) { |
| 72 | + Move-Item -Path "$($subFolder.FullName)\*" -Destination qb64pe\ |
| 73 | + } |
| 74 | +
|
| 75 | + - name: Build |
| 76 | + shell: bash |
| 77 | + run: | |
| 78 | + export QB64PE_PATH=$(pwd)/qb64pe |
| 79 | + make |
| 80 | +
|
| 81 | + - name: Package (Unix) |
| 82 | + if: runner.os != 'Windows' |
| 83 | + run: | |
| 84 | + zip -r ${{ matrix.archive_name }} . -x ".git/*" ".github/*" "tests/*" "qb64_dl/*" "qb64pe/*" "*.o" "*.obj" "*.a" "*.lib" "Makefile" |
| 85 | +
|
| 86 | + - name: Package (Windows) |
| 87 | + if: runner.os == 'Windows' |
| 88 | + run: | |
| 89 | + 7z a -tzip ${{ matrix.archive_name }} . -xr!.git -xr!.github -xr!tests -xr!qb64_dl -xr!qb64pe -x!*.o -x!*.obj -x!*.a -x!*.lib -x!Makefile |
| 90 | +
|
| 91 | + - name: Upload Artifact |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: ${{ matrix.archive_name }} |
| 95 | + path: ${{ matrix.archive_name }} |
| 96 | + |
| 97 | + create-release: |
| 98 | + name: Create GitHub Release |
| 99 | + needs: build-release |
| 100 | + runs-on: ubuntu-latest |
| 101 | + permissions: |
| 102 | + contents: write |
| 103 | + steps: |
| 104 | + - name: Download all artifacts |
| 105 | + uses: actions/download-artifact@v4 |
| 106 | + with: |
| 107 | + path: artifacts |
| 108 | + merge-multiple: true |
| 109 | + |
| 110 | + - name: Create Release |
| 111 | + uses: softprops/action-gh-release@v2 |
| 112 | + with: |
| 113 | + files: artifacts/* |
| 114 | + generate_release_notes: true |
| 115 | + draft: false |
| 116 | + prerelease: false |
0 commit comments