Skip to content

Commit

Permalink
add windows release in github action
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkD committed Dec 1, 2024
1 parent e53664d commit 124526e
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
51 changes: 49 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: release
on:
push:
tags:
- "test-release"
- "[0-9]+\\.[0-9]+"

jobs:
Expand Down Expand Up @@ -35,7 +36,20 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pack/corplink-rs-*.pkg.tar.zst
file: pack/corplink-rs-${{ github.ref_name }}*.pkg.tar.zst
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: create tarball
run: |
cp pack/pkg/corplink-rs/usr/bin/corplink-rs .
cp pack/pkg/corplink-rs/etc/corplink-rs/config.json .
tar -czf corplink-rs-${{ github.ref_name }}-linux-$(uname -m).tar.gz corplink-rs config.json
- name: upload tarball to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pack/corplink-rs-${{ github.ref_name }}*.tar.gz
tag: ${{ github.ref }}
overwrite: true
file_glob: true
Expand All @@ -54,7 +68,7 @@ jobs:
- name: build libwg
run: cd libwg && ./build.sh
- name: build package
run: cd libwg && cargo build --release
run: cargo build --release
- name: build tarball
run: |
cd target
Expand All @@ -69,3 +83,36 @@ jobs:
tag: ${{ github.ref }}
overwrite: true
file_glob: true

build-windows:
name: build-windows
needs: ['create-release']
runs-on: windows-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: '>=1.22.0'
- name: build libwg
run: cd libwg && ./build.ps1
- name: rust install gnu toolchain
run: rustup toolchain install stable-gnu
- name: rust use gnu toolchain
run: rustup default stable-x86_64-pc-windows-gnu
- name: build package
run: cargo build --release
- name: build check result
run: |
Move-Item -Path "target/release/corplink-rs.exe" -Destination "."
Move-Item -Path "config/config.json" -Destination "."
Compress-Archive -Path corplink-rs.exe,config.json -Destination corplink-rs-${{ github.ref_name }}-windows.zip
- name: upload package to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/corplink-rs-${{ github.ref_name }}-windows.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: test

on:
push:
branches:
- test

jobs:
build-windows:
name: build-windows
runs-on: windows-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: '>=1.22.0'
- name: build libwg
run: cd libwg && ./build.ps1
- name: rust install gnu toolchain
run: rustup toolchain install stable-gnu
- name: rust use gnu toolchain
run: rustup default stable-x86_64-pc-windows-gnu
- name: build package
run: cargo build --release
- name: build check result
run: |
Move-Item -Path "target/release/corplink-rs.exe" -Destination "."
Move-Item -Path "config/config.json" -Destination "."
Compress-Archive -Path corplink-rs.exe,config.json -Destination corplink-rs-${{ github.ref_name }}-windows.zip
7 changes: 7 additions & 0 deletions libwg/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
git submodule update --init --recursive

Set-Location wireguard-go

make libwg

Move-Item -Path "libwg.*" -Destination ".."
3 changes: 2 additions & 1 deletion pack/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ pkgrel=1
pkgdesc='Corplink client written in Rust'
arch=('i686' 'x86_64')
url='https://github.com/PinkD/corplink-rs'
license=('GPL2')
license=('GPL-2.0-only')
makedepends=('cargo' 'go' 'clang')
source=(
"$pkgname.$pkgver.tar.gz"::"https://github.com/PinkD/corplink-rs/archive/$pkgver.tar.gz"
"wireguard-go"::"git+https://github.com/PinkD/wireguard-go"
)

# use SKIP to avoid update PKGBUILD everytime
sha256sums=(
'SKIP'
Expand Down

0 comments on commit 124526e

Please sign in to comment.