-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (137 loc) · 5.37 KB
/
Copy pathrelease.yml
File metadata and controls
162 lines (137 loc) · 5.37 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
name: Build and Release
on:
push:
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
artifact: ssh-agent-echo-linux-x64.tar.gz
- os: windows-latest
platform: windows
artifact: ssh-agent-echo-win-x64.zip
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get Version from Directory.Build.props
id: get-version
shell: bash
run: echo "version=$(grep -oE '<Version>[^<]+' Directory.Build.props | sed 's/<Version>//')" >> $GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build Gui (Linux)
if: matrix.platform == 'linux'
run: dotnet publish -c Release -o publish -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Gui/SshAgentEcho.Gui.csproj
- name: Build Cli (Linux)
if: matrix.platform == 'linux'
run: dotnet publish -c Release -o publish -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Cli/SshAgentEcho.Cli.csproj
- name: Build Gui (Windows)
if: matrix.platform == 'windows'
run: dotnet publish -c Release -o publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Gui/SshAgentEcho.Gui.csproj
- name: Build Cli (Windows)
if: matrix.platform == 'windows'
run: dotnet publish -c Release -o publish -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true src/SshAgentEcho.Cli/SshAgentEcho.Cli.csproj
- name: Compress Linux binaries
if: matrix.platform == 'linux'
run: |
tar -czf ssh-agent-echo-linux-x64.tar.gz -C ./publish ssh-agent-echo-gui ssh-agent-echo
- name: Install nFPM
if: matrix.platform == 'linux'
run: |
NFPM_VERSION="2.35.3" # Replace with your preferred version
curl -L https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_x86_64.tar.gz | tar xz
sudo mv nfpm /usr/local/bin/
- name: Extract Version
if: matrix.platform == 'linux'
id: get_version
run: |
APP_VERSION=$(grep -oPm1 '(?<=<Version>)[^<]+' Directory.Build.props)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "Detected version: $APP_VERSION"
- name: Generate Linux packages
if: matrix.platform == 'linux'
run: |
nfpm pkg --packager deb --target publish/
nfpm pkg --packager rpm --target publish/
env:
APP_VERSION: ${{ env.APP_VERSION }}
- name: Package Windows Binaries
if: matrix.platform == 'windows'
shell: pwsh
run: |
$files = @(
"$PWD/publish/ssh-agent-echo-gui.exe",
"$PWD/publish/ssh-agent-echo.exe"
)
Compress-Archive -Path $files -DestinationPath "$PWD/ssh-agent-echo-win-x64.zip" -Force
- name: Install NSIS
if: matrix.platform == 'windows'
run: |
iwr -useb get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop update
scoop bucket add extras
scoop install nsis
- name: Generate Windows Installer
if: matrix.platform == 'windows'
shell: pwsh
run: |
$version = (Select-String '<Version>([^<]+)</Version>' Directory.Build.props).Matches[0].Groups[1].Value
& "$env:USERPROFILE\scoop\apps\nsis\current\makensis.exe" "/DVERSION=$version" .\install.nsi
- name: Upload artifact
if: matrix.platform == 'windows'
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.platform }}-binaries
path: |
${{ matrix.artifact }}
publish/SshAgentEcho-Installer*.exe
- name: Upload artifact
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.platform }}-binaries
path: |
${{ matrix.artifact }}
publish/*.deb
publish/*.rpm
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: find artifacts -type f | head -20
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: false
prerelease: false
generate_release_notes: true
files: |
artifacts/linux-binaries/ssh-agent-echo-linux-x64.tar.gz
artifacts/linux-binaries/publish/*.deb
artifacts/linux-binaries/publish/*.rpm
artifacts/windows-binaries/ssh-agent-echo-win-x64.zip
artifacts/windows-binaries/publish/SshAgentEcho-Installer-*.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}