|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +env: |
| 13 | + DOTNET_NOLOGO: true |
| 14 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 15 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + release-please: |
| 19 | + name: Release Please |
| 20 | + runs-on: ubuntu-latest |
| 21 | + outputs: |
| 22 | + release_created: ${{ steps.release.outputs.release_created }} |
| 23 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 24 | + version: ${{ steps.release.outputs.version }} |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Release Please |
| 28 | + id: release |
| 29 | + uses: google-github-actions/release-please-action@v4 |
| 30 | + with: |
| 31 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + config-file: .github/release-please-config.json |
| 33 | + manifest-file: .github/release-please-manifest.json |
| 34 | + |
| 35 | + build-artifacts: |
| 36 | + name: Build (${{ matrix.runtime }}) |
| 37 | + needs: release-please |
| 38 | + if: needs.release-please.outputs.release_created == 'true' |
| 39 | + runs-on: ${{ matrix.os }} |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + include: |
| 44 | + - runtime: win-x64 |
| 45 | + os: windows-latest |
| 46 | + artifact_ext: .zip |
| 47 | + - runtime: linux-x64 |
| 48 | + os: ubuntu-latest |
| 49 | + artifact_ext: .tar.gz |
| 50 | + - runtime: linux-arm64 |
| 51 | + os: ubuntu-latest |
| 52 | + artifact_ext: .tar.gz |
| 53 | + - runtime: osx-x64 |
| 54 | + os: macos-latest |
| 55 | + artifact_ext: .tar.gz |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout |
| 59 | + uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Setup .NET |
| 62 | + uses: actions/setup-dotnet@v4 |
| 63 | + with: |
| 64 | + dotnet-version: '10.0.x' |
| 65 | + dotnet-quality: 'preview' |
| 66 | + |
| 67 | + - name: Publish |
| 68 | + run: | |
| 69 | + dotnet publish src/LCDPossible/LCDPossible.csproj \ |
| 70 | + --configuration Release \ |
| 71 | + --runtime ${{ matrix.runtime }} \ |
| 72 | + --self-contained true \ |
| 73 | + -p:PublishSingleFile=true \ |
| 74 | + -p:IncludeNativeLibrariesForSelfExtract=true \ |
| 75 | + -p:Version=${{ needs.release-please.outputs.version }} \ |
| 76 | + --output ./publish |
| 77 | +
|
| 78 | + - name: Create archive (Windows) |
| 79 | + if: matrix.os == 'windows-latest' |
| 80 | + shell: pwsh |
| 81 | + run: | |
| 82 | + Compress-Archive -Path ./publish/* -DestinationPath ./lcdpossible-${{ needs.release-please.outputs.version }}-${{ matrix.runtime }}.zip |
| 83 | +
|
| 84 | + - name: Create archive (Linux/macOS) |
| 85 | + if: matrix.os != 'windows-latest' |
| 86 | + run: | |
| 87 | + tar -czvf ./lcdpossible-${{ needs.release-please.outputs.version }}-${{ matrix.runtime }}.tar.gz -C ./publish . |
| 88 | +
|
| 89 | + - name: Upload artifact |
| 90 | + uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: lcdpossible-${{ matrix.runtime }} |
| 93 | + path: ./lcdpossible-${{ needs.release-please.outputs.version }}-${{ matrix.runtime }}${{ matrix.artifact_ext }} |
| 94 | + |
| 95 | + build-installers: |
| 96 | + name: Build Installers |
| 97 | + needs: [release-please, build-artifacts] |
| 98 | + if: needs.release-please.outputs.release_created == 'true' |
| 99 | + runs-on: ubuntu-latest |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Checkout |
| 103 | + uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: Download all artifacts |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + path: ./artifacts |
| 109 | + |
| 110 | + - name: Setup .NET |
| 111 | + uses: actions/setup-dotnet@v4 |
| 112 | + with: |
| 113 | + dotnet-version: '10.0.x' |
| 114 | + dotnet-quality: 'preview' |
| 115 | + |
| 116 | + - name: Build DEB package |
| 117 | + run: | |
| 118 | + chmod +x ./installer/linux/debian/build-deb.sh |
| 119 | + ./installer/linux/debian/build-deb.sh ${{ needs.release-please.outputs.version }} |
| 120 | +
|
| 121 | + - name: Build RPM package |
| 122 | + run: | |
| 123 | + chmod +x ./installer/linux/rpm/build-rpm.sh |
| 124 | + ./installer/linux/rpm/build-rpm.sh ${{ needs.release-please.outputs.version }} |
| 125 | +
|
| 126 | + - name: Upload DEB package |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + with: |
| 129 | + name: lcdpossible-deb |
| 130 | + path: ./installer/linux/debian/*.deb |
| 131 | + |
| 132 | + - name: Upload RPM package |
| 133 | + uses: actions/upload-artifact@v4 |
| 134 | + with: |
| 135 | + name: lcdpossible-rpm |
| 136 | + path: ./installer/linux/rpm/*.rpm |
| 137 | + |
| 138 | + upload-to-release: |
| 139 | + name: Upload to Release |
| 140 | + needs: [release-please, build-artifacts, build-installers] |
| 141 | + if: needs.release-please.outputs.release_created == 'true' |
| 142 | + runs-on: ubuntu-latest |
| 143 | + |
| 144 | + steps: |
| 145 | + - name: Download all artifacts |
| 146 | + uses: actions/download-artifact@v4 |
| 147 | + with: |
| 148 | + path: ./artifacts |
| 149 | + |
| 150 | + - name: Display structure of downloaded files |
| 151 | + run: ls -R ./artifacts |
| 152 | + |
| 153 | + - name: Upload to GitHub Release |
| 154 | + uses: softprops/action-gh-release@v2 |
| 155 | + with: |
| 156 | + tag_name: ${{ needs.release-please.outputs.tag_name }} |
| 157 | + files: | |
| 158 | + ./artifacts/lcdpossible-win-x64/* |
| 159 | + ./artifacts/lcdpossible-linux-x64/* |
| 160 | + ./artifacts/lcdpossible-linux-arm64/* |
| 161 | + ./artifacts/lcdpossible-osx-x64/* |
| 162 | + ./artifacts/lcdpossible-deb/* |
| 163 | + ./artifacts/lcdpossible-rpm/* |
0 commit comments