Skip to content

Commit a70ce62

Browse files
authoredMar 14, 2025··
feat: add snap store release support (#469)
1 parent 5edd704 commit a70ce62

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed
 

‎.github/workflows/release.yml

+41-1
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,44 @@ jobs:
220220
--charts-repo https://github.com/$owner/$repo \
221221
--pages-branch master \
222222
--pages-index-path charts/index.yaml \
223-
--push
223+
--push
224+
snapcraft:
225+
runs-on: ubuntu-24.04
226+
env:
227+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
228+
steps:
229+
- name: Check out Git repository
230+
uses: actions/checkout@v3
231+
232+
- name: Install Snapcraft
233+
uses: samuelmeuli/action-snapcraft@v3
234+
235+
- name: Setup LXD
236+
uses: canonical/setup-lxd@main
237+
238+
- name: Use Snapcraft
239+
run: |
240+
RELEASE_VERSION=${GITHUB_REF#refs/*/}
241+
sed -i s#CRAFT_ARCH_BUILD_VERSION#$RELEASE_VERSION#g snap/snapcraft.yaml
242+
snapcraft
243+
snapcraft upload --release=stable kubevpn_${RELEASE_VERSION}_amd64.snap
244+
snapcraft-arm:
245+
runs-on: ubuntu-24.04-arm
246+
env:
247+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
248+
steps:
249+
- name: Check out Git repository
250+
uses: actions/checkout@v3
251+
252+
- name: Install Snapcraft
253+
uses: samuelmeuli/action-snapcraft@v3
254+
255+
- name: Setup LXD
256+
uses: canonical/setup-lxd@main
257+
258+
- name: Use Snapcraft
259+
run: |
260+
RELEASE_VERSION=${GITHUB_REF#refs/*/}
261+
sed -i s#CRAFT_ARCH_BUILD_VERSION#$RELEASE_VERSION#g snap/snapcraft.yaml
262+
snapcraft
263+
snapcraft upload --release=stable kubevpn_${RELEASE_VERSION}_arm64.snap

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![Releases][7]](https://github.com/kubenetworks/kubevpn/releases)
1010
[![GoDoc](https://godoc.org/github.com/kubenetworks/kubevpn?status.png)](https://pkg.go.dev/github.com/wencaiwulue/kubevpn/v2)
1111
[![codecov](https://codecov.io/gh/wencaiwulue/kubevpn/graph/badge.svg?token=KMDSINSDEP)](https://codecov.io/gh/wencaiwulue/kubevpn)
12+
[![Snapcraft](https://snapcraft.io/kubevpn/badge.svg)](https://snapcraft.io/kubevpn)
1213

1314
[1]: https://img.shields.io/github/actions/workflow/status/kubenetworks/kubevpn/release.yml?logo=github
1415

‎README_ZH.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![Releases][7]](https://github.com/kubenetworks/kubevpn/releases)
1010
[![GoDoc](https://godoc.org/github.com/kubenetworks/kubevpn?status.png)](https://pkg.go.dev/github.com/wencaiwulue/kubevpn/v2)
1111
[![codecov](https://codecov.io/gh/wencaiwulue/kubevpn/graph/badge.svg?token=KMDSINSDEP)](https://codecov.io/gh/wencaiwulue/kubevpn)
12+
[![Snapcraft](https://snapcraft.io/kubevpn/badge.svg)](https://snapcraft.io/kubevpn)
1213

1314
[1]: https://img.shields.io/github/actions/workflow/status/kubenetworks/kubevpn/release.yml?logo=github
1415

‎snap/snapcraft.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: kubevpn
2+
version: CRAFT_ARCH_BUILD_VERSION
3+
summary: Cloud Native Dev Environment
4+
description: KubeVPN offers a Cloud Native Dev Environment that connects to kubernetes cluster network.
5+
adopt-info: kubevpn
6+
base: core24
7+
8+
confinement: strict
9+
grade: stable
10+
11+
platforms:
12+
amd64:
13+
build-on: [amd64]
14+
build-for: [amd64]
15+
arm64:
16+
build-on: [arm64]
17+
build-for: [arm64]
18+
19+
apps:
20+
kubevpn:
21+
command: bin/kubevpn
22+
plugs:
23+
- network
24+
- network-bind
25+
26+
parts:
27+
kubevpn-builder:
28+
plugin: make
29+
source: .
30+
build-packages:
31+
- git
32+
- golang
33+
- make
34+
build-environment:
35+
- GOARCH: "$CRAFT_ARCH_BUILD_ON"
36+
override-build: |
37+
git config --global --add safe.directory $PWD
38+
make kubevpn-linux-$CRAFT_ARCH_BUILD_ON
39+
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
40+
install -m 0755 bin/kubevpn $SNAPCRAFT_PART_INSTALL/bin/kubevpn

0 commit comments

Comments
 (0)
Please sign in to comment.