-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (121 loc) · 4.28 KB
/
release.yml
File metadata and controls
152 lines (121 loc) · 4.28 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
name: Release
on:
push:
tags:
- "v*.*.*" # Triggers on version tags like v0.2.0, v1.0.0, etc.
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build binaries
run: |
# Create dist directory
mkdir -p dist
# Define platforms
PLATFORMS=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
"windows/arm64"
)
for PLATFORM in "${PLATFORMS[@]}"; do
GOOS=${PLATFORM%/*}
GOARCH=${PLATFORM#*/}
OUTPUT_NAME="sess"
if [ "$GOOS" = "windows" ]; then
OUTPUT_NAME="${OUTPUT_NAME}.exe"
fi
echo "Building for $GOOS/$GOARCH..."
# versioninfo package automatically uses git tags and commits
# -s -w strips debug info for smaller binaries
GOOS=$GOOS GOARCH=$GOARCH go build \
-ldflags="-s -w" \
-o "dist/${OUTPUT_NAME}" \
./cmd/sess
# Create tarball/zip
cd dist
if [ "$GOOS" = "windows" ]; then
zip "sess-${GOOS}-${GOARCH}.zip" "${OUTPUT_NAME}"
rm "${OUTPUT_NAME}"
else
tar czf "sess-${GOOS}-${GOARCH}.tar.gz" "${OUTPUT_NAME}"
rm "${OUTPUT_NAME}"
fi
cd ..
done
- name: Generate checksums
run: |
cd dist
sha256sum * > checksums.txt
cat checksums.txt
- name: Prepare installer asset
run: |
cp scripts/install.sh dist/install.sh
- name: Validate installer against release artifacts
run: |
bash -n dist/install.sh
INSTALL_DIR="$RUNNER_TEMP/sess-install/bin"
mkdir -p "$INSTALL_DIR"
SESS_BASE_URL="file://$PWD/dist" \
SESS_INSTALL_DIR="$INSTALL_DIR" \
bash dist/install.sh
test -x "$INSTALL_DIR/sess"
"$INSTALL_DIR/sess" --version
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.zip
dist/checksums.txt
dist/install.sh
draft: false
prerelease: false
generate_release_notes: true
body: |
## Installation
### Quick Install
```bash
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/install.sh | sudo bash
```
By default this installs `sess` to `/usr/local/bin/sess`.
To install into `/usr/bin` instead:
```bash
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/install.sh | sudo env SESS_INSTALL_DIR=/usr/bin bash
```
### Manual Install
Linux/macOS archive contents extract to a binary named `sess`, not a platform-named file.
```bash
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/sess-linux-amd64.tar.gz | tar xz
sudo install -m 0755 sess /usr/local/bin/sess
```
### Windows (PowerShell)
```powershell
Invoke-WebRequest -Uri "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/sess-windows-amd64.zip" -OutFile "sess.zip"
Expand-Archive sess.zip -DestinationPath .
# Move sess.exe to a directory in your PATH
```
## What's Changed
See the full changelog below.
## Verify Installation
```bash
sess --version
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}