-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (136 loc) · 4.06 KB
/
release.yml
File metadata and controls
163 lines (136 loc) · 4.06 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.2.3)'
required: true
type: string
permissions:
contents: write
jobs:
# Stage 1: Verify compilation
compile:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.meta.outputs.tag }}
version: ${{ steps.meta.outputs.version }}
steps:
- name: Resolve tag and version
id: meta
shell: bash
run: |
if [ "${{ github.event_name }}" = "push" ]; then
TAG="${{ github.ref_name }}"
else
TAG="${{ inputs.tag }}"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
with:
ref: ${{ steps.meta.outputs.tag }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Compile
run: dotnet build LiveLingo.slnx -c Release --nologo
# Stage 2: Run tests
test:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.compile.outputs.tag }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore tools
run: dotnet tool restore
- name: Test
run: |
chmod +x build.sh
./build.sh Test
# Stage 3: Build platform-specific installers
pack:
needs: [compile, test]
strategy:
matrix:
include:
- os: windows-latest
runtime: win-x64
shell: pwsh
- os: macos-latest
runtime: osx-arm64
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.compile.outputs.tag }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Restore tools
run: dotnet tool restore
- name: Pack (Windows)
if: matrix.runtime == 'win-x64'
shell: pwsh
run: ./build.ps1 Pack PackMsi --skip Test --Runtime ${{ matrix.runtime }} --Version ${{ needs.compile.outputs.version }}
- name: Pack (macOS)
if: matrix.runtime == 'osx-arm64'
shell: bash
run: |
chmod +x build.sh
./build.sh PackMac --skip Test --Runtime ${{ matrix.runtime }} --Version ${{ needs.compile.outputs.version }}
- name: Upload installers
uses: actions/upload-artifact@v4
with:
name: installers-${{ matrix.runtime }}
path: |
releases/*.exe
releases/*.msi
releases/*.pkg
if-no-files-found: error
# Stage 4: Create GitHub Release with only installer files
release:
needs: [compile, pack]
runs-on: ubuntu-latest
steps:
- name: Download all installer artifacts
uses: actions/download-artifact@v4
with:
path: installers
pattern: installers-*
merge-multiple: true
- name: List release files
run: ls -la installers/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compile.outputs.tag }}
name: LiveLingo ${{ needs.compile.outputs.tag }}
files: |
installers/*.exe
installers/*.msi
installers/*.pkg
generate_release_notes: true