forked from RattletraPM/Snickerstream
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (126 loc) · 4.63 KB
/
Copy pathrelease.yml
File metadata and controls
139 lines (126 loc) · 4.63 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: build-and-package
# Builds and packages 3DSnickerStream (Avalonia) for Windows and Linux on their
# native runners. A v* tag additionally drafts a GitHub Release with the packaged
# artifacts. macOS is built locally on the maintainer's Mac (ad-hoc signing + the
# "damaged" Gatekeeper fix are simplest there) and its asset is uploaded by hand.
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
inputs:
version:
description: 'Version to stamp on artifacts (e.g. 2.0.0)'
required: false
default: '2.0.0'
env:
PROJECT: Snickerstream.Avalonia/Snickerstream.Avalonia.csproj
DOTNET_NOLOGO: 'true'
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
rid: win-x64
kind: win
- os: ubuntu-latest
rid: linux-x64
kind: linux
# macOS is built locally on the maintainer's Mac, not in CI (see header).
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
# Version = tag (strip leading v) > workflow_dispatch input > 2.0.0
- name: Resolve version
id: ver
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
V="${GITHUB_REF#refs/tags/v}"
else
V="${{ github.event.inputs.version || '2.0.0' }}"
fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Version: $V"
# Windows: single-file self-contained exe (+ tessdata + x64 natives via the csproj target).
- name: Publish (Windows)
if: matrix.kind == 'win'
shell: bash
run: |
dotnet publish "$PROJECT" -c Release -r ${{ matrix.rid }} --self-contained true \
-p:PublishSingleFile=true -p:Version=${{ steps.ver.outputs.version }} \
-o "publish/${{ matrix.rid }}"
# Linux/macOS: self-contained folder (single-file complicates native asset loading).
- name: Publish (Unix)
if: matrix.kind != 'win'
shell: bash
run: |
dotnet publish "$PROJECT" -c Release -r ${{ matrix.rid }} --self-contained true \
-p:Version=${{ steps.ver.outputs.version }} \
-o "publish/${{ matrix.rid }}"
# ---- package ----
- name: Package (Windows zip)
if: matrix.kind == 'win'
shell: pwsh
run: |
$v = "${{ steps.ver.outputs.version }}"
New-Item -ItemType Directory -Force dist | Out-Null
Compress-Archive -Path "publish/${{ matrix.rid }}/*" `
-DestinationPath "dist/3DSnickerStream-v$v-${{ matrix.rid }}.zip" -Force
- name: Package (macOS .app zip)
if: matrix.kind == 'mac'
shell: bash
run: |
v="${{ steps.ver.outputs.version }}"
mkdir -p dist
bash packaging/macos/make-app.sh "publish/${{ matrix.rid }}" "dist/3DSnickerStream.app" "$v"
# ditto (not zip -r) preserves the code signature and bundle metadata inside the .app.
( cd dist && ditto -c -k --keepParent "3DSnickerStream.app" "3DSnickerStream-v$v-${{ matrix.rid }}.zip" && rm -rf "3DSnickerStream.app" )
- name: Package (Linux tar.gz)
if: matrix.kind == 'linux'
shell: bash
run: |
v="${{ steps.ver.outputs.version }}"
mkdir -p dist
tar -C "publish/${{ matrix.rid }}" -czf "dist/3DSnickerStream-v$v-${{ matrix.rid }}.tar.gz" .
- name: Package (Linux AppImage, best effort)
if: matrix.kind == 'linux'
continue-on-error: true
shell: bash
env:
APPIMAGE_EXTRACT_AND_RUN: '1'
run: |
v="${{ steps.ver.outputs.version }}"
sudo apt-get update && sudo apt-get install -y imagemagick libfuse2 || true
bash packaging/linux/make-appimage.sh "publish/${{ matrix.rid }}" \
"dist/3DSnickerStream-v$v-linux-x86_64.AppImage" "$v"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: 3DSnickerStream-${{ matrix.rid }}
path: dist/*
if-no-files-found: error
release:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Draft release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: artifacts/**/*