Create deb and rpm automatically #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Build OpenLauncher | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu | |
rid: linux-x64 | |
- os: windows | |
rid: win-x64 | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.0.x' | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build -c Release --no-restore | |
- name: Test | |
run: dotnet test --no-restore | |
- name: Publish | |
working-directory: src/openlauncher | |
run: dotnet publish -c Release -r ${{ matrix.rid }} --self-contained | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "OpenLauncher-${{ matrix.rid }}" | |
path: src/openlauncher/bin/Release/net7.0/${{ matrix.rid }}/publish/**/* | |
package: | |
name: deb and rpm packaging | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get previously created bin | |
uses: actions/download-artifact@v4 | |
with: | |
name: "OpenLauncher-linux-x64" | |
- name: Prepare to create deb and rpm files | |
run: | | |
mkdir -p .pkg/usr/bin | |
mkdir -p .pkg/usr/share/applications | |
mkdir -p .pkg/usr/share/icons | |
cp src/openlauncher/resources/logo.svg .pkg/usr/share/icons/openlauncher.svg | |
cp src/openlauncher/resources/OpenLauncher.desktop .pkg/usr/share/applications/OpenLauncher.desktop | |
cp $GITHUB_WORKSPACE/openlauncher .pkg/usr/bin/openlauncher | |
chmod +x .pkg/usr/bin/openlauncher | |
- name: Create rpm | |
uses: jiro4989/build-rpm-action@v2 | |
with: | |
package: openlauncher | |
summary: 'A launcher for automatically downloading the latest, or specific versions of OpenRCT2 and OpenLoco.' | |
package_root: .pkg | |
maintainer: IntelOrca | |
version: ${{github.ref_name}} # refs/tags/v*.*.* | |
arch: 'x86_64' | |
license: 'MIT' | |
- name: Create deb | |
uses: jiro4989/build-deb-action@v3 | |
with: | |
package: openlauncher | |
package_root: .pkg | |
maintainer: IntelOrca | |
version: ${{github.ref_name}} # refs/tags/v*.*.* | |
arch: 'amd64' | |
desc: 'A launcher for automatically downloading the latest, or specific versions of OpenRCT2 and OpenLoco.' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-deb | |
path: | | |
./*.deb | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-rpm | |
path: | | |
./*.rpm | |
!./*-debuginfo-*.rpm | |
release: | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: [build, package] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: artifacts/ | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/openlauncher | |
artifacts/*.exe | |
artifacts/*.rpm | |
artifacts/*.deb |