-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (81 loc) · 2.97 KB
/
Copy pathpackages.yml
File metadata and controls
92 lines (81 loc) · 2.97 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
name: Packages
on:
push:
# Only full semver tags publish release binaries. The moving `v1` alias tag
# (used for `XtremeOwnage/Netdocs@v1`) must not create a stray `v1` release.
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
workflow_dispatch:
inputs:
version:
description: Package version (without leading v)
required: false
default: "0.0.0"
permissions:
contents: write
jobs:
packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Resolve version
id: version
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
else
echo "value=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
fi
- name: Publish self-contained binaries (linux, windows, macos)
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
for rid in linux-x64 win-x64 osx-x64 osx-arm64; do
echo "::group::publish $rid"
dotnet publish src/Netdocs.Cli -c Release -r "$rid" --self-contained \
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true \
-p:EnableCompressionInSingleFile=true \
-p:Version="${VERSION:-0.0.0}" -o "dist/$rid"
echo "::endgroup::"
done
- name: Stage standalone executables
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
mkdir -p out
v="${VERSION:-0.0.0}"
cp "dist/linux-x64/netdocs" "out/netdocs-${v}-linux-x64"
cp "dist/osx-x64/netdocs" "out/netdocs-${v}-osx-x64"
cp "dist/osx-arm64/netdocs" "out/netdocs-${v}-osx-arm64"
cp "dist/win-x64/netdocs.exe" "out/netdocs-${v}-win-x64.exe"
cp install/install.ps1 "out/install.ps1"
cp install/uninstall.ps1 "out/uninstall.ps1"
ls -l out
- name: Install nfpm
run: |
curl -sSfL "https://github.com/goreleaser/nfpm/releases/latest/download/nfpm_$(uname -m)_Linux.tar.gz" \
| sudo tar -xz -C /usr/local/bin nfpm || {
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
echo "$HOME/go/bin" >> "$GITHUB_PATH"
}
- name: Build .deb and .rpm
env:
VERSION: ${{ steps.version.outputs.value }}
run: |
mkdir -p out
nfpm package -f packaging/nfpm.yaml -p deb -t out/
nfpm package -f packaging/nfpm.yaml -p rpm -t out/
ls -l out
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: netdocs-packages
path: out/*
- name: Attach to release
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v3
with:
files: out/*