-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 2.02 KB
/
publish_console_app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Publish release console app
# Declaring custom variables
env:
PROJECT_NAME: Flamencode
RELEASE_FOLDER: release
OPERATIVE_SYSTEM_RUNTIMES: win-x64 win-arm64 osx-x64 osx-arm64 linux-x64 linux-arm linux-arm64
OPERATIVE_SYSTEM_FOLDERS: Windows_x64 Windows_arm64 Macos_x64 Macos_arm64 Linux_x64 Linux_arm Linux_arm64
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: '1.0.0'
jobs:
build:
# use ubuntu-latest image to run steps on
runs-on: ubuntu-latest
steps:
# uses GitHub's checkout action to checkout code form the master branch
- uses: actions/checkout@v4
# sets up .NET SDK
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.X
# Build project to the release-folder
- name: Build .NET Project
run: |
IFS=' ' read -ra runtimes <<< "${{ env.OPERATIVE_SYSTEM_RUNTIMES }}"
IFS=' ' read -ra folders <<< "${{ env.OPERATIVE_SYSTEM_FOLDERS }}"
releaseFolder=${{env.RELEASE_FOLDER}}
for (( i=0; i<${#runtimes[@]}; i++ )); do
runtime=${runtimes[i]}
folder=${folders[i]}
fullPath=${releaseFolder}/${folder}
dotnet publish $PROJECT_NAME/$PROJECT_NAME.csproj -r $runtime -c Release -o $fullPath --nologo --self-contained true /p:PublishSingleFile=true /p:DebugType=None /p:DebugSymbols=false
cd $fullPath
zip -r ../${folder}.zip *
cd ../..
done
- name: Create release
run: |
assets=()
for asset in ./${{env.RELEASE_FOLDER}}/*.zip; do
assets+=("$asset")
done
tag_name=v${{ github.event.inputs.version }}
gh release create "$tag_name" "${assets[@]}" --title "$tag_name" --notes "$tag_name"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}