Skip to content

Commit 1537486

Browse files
committed
use semver and refactor build
- use semver to support go modules - use github-actions to build the artifacts - drop the freebsd package - it was used very little. please ping me if you use it under FreeBSD! closes #4
1 parent 1d417ce commit 1537486

File tree

12 files changed

+145
-343
lines changed

12 files changed

+145
-343
lines changed

.github/workflows/release.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Build release
2+
on:
3+
push:
4+
tags:
5+
- v[0-9]+.[0-9]+.[0-9]+
6+
7+
jobs:
8+
build-linux:
9+
10+
strategy:
11+
fail-fast: false
12+
13+
matrix:
14+
platform:
15+
- deb
16+
- rpm
17+
- osx
18+
arch:
19+
- i386
20+
- amd64
21+
22+
name: build for linux / macos
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: cachix/install-nix-action@v9
27+
28+
- name: build
29+
run: |
30+
set -x
31+
git fetch --tags -f
32+
mkdir build-output/
33+
PACKAGE="package-${{ matrix.platform }}"
34+
echo "BUILD: $PLATFORM@${{ matrix.arch }}"
35+
BUILD=$(nix-build --no-out-link --no-build-output -A $PACKAGE --argstr arch ${{ matrix.arch }})
36+
cp -v $BUILD/* build-output/
37+
38+
- name: upload assets
39+
uses: softprops/action-gh-release@v1
40+
with:
41+
files: build-output/*
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
46+
47+
build-windows:
48+
49+
strategy:
50+
fail-fast: false
51+
52+
matrix:
53+
arch:
54+
- i386
55+
- amd64
56+
57+
name: build for windows
58+
runs-on: windows-latest
59+
steps:
60+
- uses: actions/checkout@v2
61+
62+
- name: prepare
63+
shell: bash
64+
run: |
65+
choco install nsis pandoc
66+
67+
git fetch --tags -f
68+
echo "::set-env name=VERSION::$(git describe --tags --always)"
69+
echo "::set-env name=LDFLAGS::-X github.com/j-keck/lsleases/pkg/daemon.version=%VERSION% -X main.version=%VERSION%"
70+
echo "::set-env name=PLATFORM::${{ matrix.arch }}"
71+
72+
if [ ${{ matrix.arch }} == "i386" ]; then
73+
echo "::set-env name=GOARCH::386"
74+
else
75+
echo "::set-env name=GOARCH::${{ matrix.arch }}"
76+
fi
77+
78+
79+
- name: build
80+
run: |
81+
82+
go build -ldflags "${{ env['LDFLAGS'] }}" ./cmd/lsleases
83+
go build -ldflags "${{ env['LDFLAGS'] }}" ./cmd/lsleasesd
84+
85+
pandoc -s -o manual-windows.html docs/manual-windows.org
86+
87+
88+
mkdir build-installer
89+
copy lsleases.exe build-installer\
90+
copy lsleasesd.exe build-installer\
91+
copy LICENSE build-installer\
92+
copy manual-windows.html build-installer\
93+
copy build\windows\installer.nsi build-installer\
94+
copy build\windows\${{ matrix.arch }}\nssm.exe build-installer\
95+
copy build\windows\*.bat build-installer\
96+
pushd .
97+
chdir build-installer\
98+
makensis installer.nsi
99+
popd
100+
101+
102+
mkdir build-standalone\lsleases
103+
copy lsleases.exe build-standalone\lsleases\
104+
copy LICENSE build-standalone\lsleases\
105+
copy manual-windows.html build-standalone\lsleases\
106+
copy build\windows\capture-leases.bat build-standalone\lsleases\
107+
pushd .
108+
chdir build-standalone\
109+
7z.exe a lsleases-${{ env['VERSION'] }}-${{ matrix.arch }}-windows-standalone.zip .\lsleases
110+
popd
111+
112+
- name: upload assets
113+
uses: softprops/action-gh-release@v1
114+
with:
115+
files: |
116+
build-installer/lsleases-v*.exe
117+
build-standalone/lsleases*.zip
118+
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
122+

build/Jenkinsfile

Lines changed: 0 additions & 98 deletions
This file was deleted.

build/appveyor.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

build/freebsd/build.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)