Repository navigation
125 lines (107 loc) · 4.19 KB
/
Copy pathrelease.yml
File metadata and controls
125 lines (107 loc) · 4.19 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
# On-demand publishing for tagged portable releases. The ref must be a tag
# matching VERSION so both artifact names and the embedded client version agree
# with the OTA manifest.
name: release
on:
workflow_dispatch:
inputs:
ref:
description: 'Release tag matching VERSION (for example v0.3.2)'
required: true
default: 'v0.3.2'
permissions:
contents: write
env:
RELEASE_REF: ${{ inputs.ref }}
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
# The frontend consumes @ha/ui through a file: dependency pinned as a
# git submodule at the repo root (ha-ui/), so check it out together
# with the requested ref — the build reproduces exactly the ha-ui
# commit that ref recorded.
- name: Checkout the requested ref
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
submodules: true
- name: Validate release tag
id: version
run: |
version="$(tr -d '[:space:]' < VERSION)"
version="${version#v}"
if [[ ! "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "VERSION must contain a semantic version" >&2
exit 1
fi
if [ "$RELEASE_REF" != "v$version" ]; then
echo "Release ref $RELEASE_REF does not match VERSION v$version" >&2
exit 1
fi
git rev-parse --verify "refs/tags/$RELEASE_REF" >/dev/null
echo "version=v$version" >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.15.0
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libwebkit2gtk-4.1-dev libgtk-3-dev pkg-config \
gcc-mingw-w64-x86-64
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version: 22
- name: Install @ha/ui dependencies
run: cd ha-ui && npm ci
- name: Install frontend dependencies
working-directory: frontend
run: npm ci
- name: Stub frontend dist for embed
run: |
mkdir -p frontend/dist
touch frontend/dist/.gitkeep
- name: Generate Wails bindings
run: wails generate module
- name: Build Linux binary
env:
RELEASE_VERSION: ${{ steps.version.outputs.version }}
run: wails build -ldflags "-X main.version=$RELEASE_VERSION" -o "SamuelClient-$RELEASE_VERSION-linux-amd64"
- name: Build Windows binary (mingw cross-compile)
env:
RELEASE_VERSION: ${{ steps.version.outputs.version }}
CC: x86_64-w64-mingw32-gcc
run: wails build -platform windows/amd64 -ldflags "-X main.version=$RELEASE_VERSION" -o "SamuelClient-$RELEASE_VERSION-windows-amd64.exe"
- name: Collect artifacts
env:
RELEASE_VERSION: ${{ steps.version.outputs.version }}
run: |
mkdir -p release-assets
cp "build/bin/SamuelClient-$RELEASE_VERSION-linux-amd64" release-assets/
cp "build/bin/SamuelClient-$RELEASE_VERSION-windows-amd64.exe" release-assets/
{
echo "## Release artifacts for $RELEASE_VERSION"
ls -l release-assets
} >> "$GITHUB_STEP_SUMMARY"
- name: Create or update Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ steps.version.outputs.version }}
run: |
cat > /tmp/release-notes.md <<NOTES
Portable release for $RELEASE_VERSION.
- Signed OTA manifests with user-confirmed installation.
- Mandatory update support and SHA-256-verified downloads.
- Linux amd64 and Windows amd64 portable builds.
NOTES
if gh release view "$RELEASE_VERSION" >/dev/null 2>&1; then
gh release upload "$RELEASE_VERSION" release-assets/* --clobber
else
gh release create "$RELEASE_VERSION" release-assets/* \
--title "$RELEASE_VERSION" --notes-file /tmp/release-notes.md
fi