diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb9777ff..3e52f7a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -220,4 +220,44 @@ jobs: --charts-repo https://github.com/$owner/$repo \ --pages-branch master \ --pages-index-path charts/index.yaml \ - --push \ No newline at end of file + --push + snapcraft: + runs-on: ubuntu-24.04 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v3 + + - name: Setup LXD + uses: canonical/setup-lxd@main + + - name: Use Snapcraft + run: | + RELEASE_VERSION=${GITHUB_REF#refs/*/} + sed -i s#CRAFT_ARCH_BUILD_VERSION#$RELEASE_VERSION#g snap/snapcraft.yaml + snapcraft + snapcraft upload --release=stable kubevpn_${RELEASE_VERSION}_amd64.snap + snapcraft-arm: + runs-on: ubuntu-24.04-arm + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v3 + + - name: Setup LXD + uses: canonical/setup-lxd@main + + - name: Use Snapcraft + run: | + RELEASE_VERSION=${GITHUB_REF#refs/*/} + sed -i s#CRAFT_ARCH_BUILD_VERSION#$RELEASE_VERSION#g snap/snapcraft.yaml + snapcraft + snapcraft upload --release=stable kubevpn_${RELEASE_VERSION}_arm64.snap \ No newline at end of file diff --git a/README.md b/README.md index bde69b1f..27722326 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![Releases][7]](https://github.com/kubenetworks/kubevpn/releases) [![GoDoc](https://godoc.org/github.com/kubenetworks/kubevpn?status.png)](https://pkg.go.dev/github.com/wencaiwulue/kubevpn/v2) [![codecov](https://codecov.io/gh/wencaiwulue/kubevpn/graph/badge.svg?token=KMDSINSDEP)](https://codecov.io/gh/wencaiwulue/kubevpn) +[![Snapcraft](https://snapcraft.io/kubevpn/badge.svg)](https://snapcraft.io/kubevpn) [1]: https://img.shields.io/github/actions/workflow/status/kubenetworks/kubevpn/release.yml?logo=github diff --git a/README_ZH.md b/README_ZH.md index 4f732a20..ebdc6f75 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -9,6 +9,7 @@ [![Releases][7]](https://github.com/kubenetworks/kubevpn/releases) [![GoDoc](https://godoc.org/github.com/kubenetworks/kubevpn?status.png)](https://pkg.go.dev/github.com/wencaiwulue/kubevpn/v2) [![codecov](https://codecov.io/gh/wencaiwulue/kubevpn/graph/badge.svg?token=KMDSINSDEP)](https://codecov.io/gh/wencaiwulue/kubevpn) +[![Snapcraft](https://snapcraft.io/kubevpn/badge.svg)](https://snapcraft.io/kubevpn) [1]: https://img.shields.io/github/actions/workflow/status/kubenetworks/kubevpn/release.yml?logo=github diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000..5305d4ab --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,40 @@ +name: kubevpn +version: CRAFT_ARCH_BUILD_VERSION +summary: Cloud Native Dev Environment +description: KubeVPN offers a Cloud Native Dev Environment that connects to kubernetes cluster network. +adopt-info: kubevpn +base: core24 + +confinement: strict +grade: stable + +platforms: + amd64: + build-on: [amd64] + build-for: [amd64] + arm64: + build-on: [arm64] + build-for: [arm64] + +apps: + kubevpn: + command: bin/kubevpn + plugs: + - network + - network-bind + +parts: + kubevpn-builder: + plugin: make + source: . + build-packages: + - git + - golang + - make + build-environment: + - GOARCH: "$CRAFT_ARCH_BUILD_ON" + override-build: | + git config --global --add safe.directory $PWD + make kubevpn-linux-$CRAFT_ARCH_BUILD_ON + mkdir -p $SNAPCRAFT_PART_INSTALL/bin + install -m 0755 bin/kubevpn $SNAPCRAFT_PART_INSTALL/bin/kubevpn \ No newline at end of file