Skip to content

Commit 70be1d0

Browse files
committed
simplify Launcher CI
1 parent b392bc1 commit 70be1d0

1 file changed

Lines changed: 53 additions & 91 deletions

File tree

.github/workflows/ci-launcher.yml

Lines changed: 53 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,42 @@ on:
1717

1818
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1919
jobs:
20-
build_win:
21-
# The type of runner that the job will run on
22-
runs-on: windows-latest
20+
build:
21+
strategy:
22+
matrix:
23+
profile: [
24+
{
25+
name: Windows,
26+
runs_on: windows-latest,
27+
28+
runtime_identifier: win-x64,
29+
archive_name: otapi_launcher_win.zip,
30+
31+
release_tag: launcher-windows,
32+
},
33+
{
34+
name: MacOS,
35+
runs_on: macos-latest,
36+
37+
runtime_identifier: osx-x64,
38+
archive_name: otapi_launcher_macos.zip,
39+
40+
release_tag: launcher-macos,
41+
},
42+
{
43+
name: Linux,
44+
runs_on: ubuntu-latest,
45+
46+
runtime_identifier: ubuntu.16.04-x64,
47+
archive_name: otapi_launcher_linux.zip,
48+
49+
release_tag: launcher-linux,
50+
},
51+
]
52+
defaults:
53+
run:
54+
shell: bash
55+
runs-on: ${{ matrix.profile.runs_on }}
2356

2457
# Steps represent a sequence of tasks that will be executed as part of the job
2558
steps:
@@ -35,103 +68,32 @@ jobs:
3568
# - name: MonoMod dev build
3669
# run: dotnet nuget add source https://pkgs.dev.azure.com/MonoMod/MonoMod/_packaging/DevBuilds%40Local/nuget/v3/index.json -n DevBuilds@Local
3770

38-
- name: Build and publish windows
71+
- name: Build
3972
run: |
4073
cd OTAPI.Client.Launcher
41-
dotnet publish -r win-x64 --framework net6.0 -p:PublishReadyToRun=true --self-contained false -c Release
42-
Compress-Archive bin/Release/net6.0/win-x64/publish ../otapi_launcher_win.zip
74+
dotnet publish -r ${{ matrix.profile.runtime_identifier }} --framework net6.0 -p:PublishReadyToRun=true --self-contained false -c Release
75+
if ${{ matrix.profile.runs_on != 'macos_latest' }} ; then
76+
7z a ../${{ matrix.profile.archive_name }} .bin/Release/net6.0/${{ matrix.profile.runtime_identifier }}/publish/*
77+
else
78+
mkdir -p OTAPI.app/Contents/Resources
79+
mv bin/Release/net6.0/osx-x64/publish OTAPI.app/Contents/MacOS
80+
cp ../docs/MacOS.Info.plist OTAPI.app/Contents/Info.plist
81+
cp OTAPI.osx.sh OTAPI.app/Contents/MacOS/OTAPI
82+
chmod +x OTAPI.app/Contents/MacOS/OTAPI
83+
7z a ../${{ matrix.profile.archive_name }} OTAPI.app
84+
fi
4385
4486
# - uses: actions/upload-artifact@v2
4587
# with:
46-
# name: Windows Launcher
47-
# path: OTAPI.Client.Launcher/bin/Release/net6.0/win-x64/publish
88+
# name: ${{ matrix.profile.name }} Launcher
89+
# path: OTAPI.Client.Launcher/bin/Release/net6.0/${{ matrix.profile.runtime_identifier }}/publish
4890

4991
- uses: "marvinpinto/action-automatic-releases@latest"
5092
with:
5193
repo_token: "${{ secrets.GITHUB_TOKEN }}"
52-
automatic_release_tag: "launcher-windows"
94+
automatic_release_tag: ${{ matrix.profile.release_tag }}
5395
prerelease: true
54-
title: "Windows Launcher"
96+
title: "${{ matrix.profile.name }} Launcher"
5597
files: |
5698
LICENSE.txt
57-
otapi_launcher_win.zip
58-
59-
build_osx:
60-
# The type of runner that the job will run on
61-
runs-on: macos-latest
62-
63-
# Steps represent a sequence of tasks that will be executed as part of the job
64-
steps:
65-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
66-
- uses: actions/checkout@v3
67-
with:
68-
submodules: 'recursive'
69-
70-
- uses: actions/setup-dotnet@v2
71-
with:
72-
dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the 3.1 channel
73-
74-
- name: Build and publish macos
75-
run: |
76-
cd OTAPI.Client.Launcher
77-
dotnet publish -r osx-x64 --framework net6.0 -p:PublishReadyToRun=true --self-contained false -c Release
78-
mkdir OTAPI.app
79-
mkdir OTAPI.app/Contents
80-
mkdir OTAPI.app/Contents/Resources
81-
mv bin/Release/net6.0/osx-x64/publish OTAPI.app/Contents/MacOS
82-
cp ../docs/MacOS.Info.plist OTAPI.app/Contents/Info.plist
83-
cp OTAPI.osx.sh OTAPI.app/Contents/MacOS/OTAPI
84-
chmod +x OTAPI.app/Contents/MacOS/OTAPI
85-
zip -r ../otapi_launcher_macos.zip OTAPI.app
86-
87-
# - uses: actions/upload-artifact@v2
88-
# with:
89-
# name: MacOS Launcher
90-
# path: OTAPI.Client.Launcher/bin/Release/net6.0/osx.10.11-x64/publish
91-
92-
- uses: "marvinpinto/action-automatic-releases@latest"
93-
with:
94-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
95-
automatic_release_tag: "launcher-macos"
96-
prerelease: true
97-
title: "MacOS Launcher"
98-
files: |
99-
LICENSE.txt
100-
otapi_launcher_macos.zip
101-
102-
# This workflow contains a single job called "build"
103-
build_lin:
104-
# The type of runner that the job will run on
105-
runs-on: ubuntu-latest
106-
107-
# Steps represent a sequence of tasks that will be executed as part of the job
108-
steps:
109-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
110-
- uses: actions/checkout@v3
111-
with:
112-
submodules: 'recursive'
113-
114-
- uses: actions/setup-dotnet@v2
115-
with:
116-
dotnet-version: '6.0.x' # SDK Version to use; x will use the latest version of the 3.1 channel
117-
118-
- name: Build and publish linux
119-
run: |
120-
cd OTAPI.Client.Launcher
121-
dotnet publish -r ubuntu.16.04-x64 --framework net6.0 -p:PublishReadyToRun=true --self-contained false -c Release
122-
zip -r ../otapi_launcher_linux.zip bin/Release/net6.0/ubuntu.16.04-x64/publish
123-
124-
# - uses: actions/upload-artifact@v2
125-
# with:
126-
# name: Linux Launcher
127-
# path: OTAPI.Client.Launcher/bin/Release/net6.0/ubuntu.16.04-x64/publish
128-
129-
- uses: "marvinpinto/action-automatic-releases@latest"
130-
with:
131-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
132-
automatic_release_tag: "launcher-linux"
133-
prerelease: true
134-
title: "Linux Launcher"
135-
files: |
136-
LICENSE.txt
137-
otapi_launcher_linux.zip
99+
${{ matrix.profile.archive_name }}

0 commit comments

Comments
 (0)