Add building via gh workflows

This commit is contained in:
Sam W 2023-05-04 23:12:16 +01:00
parent 8b1358c8d1
commit 5746a1a4fd
3 changed files with 58 additions and 1 deletions

29
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: main
on: push
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
- run: nix develop -c go generate
- run: nix develop -c go test
release:
name: Build Release
if: startsWith(github.event.ref, 'refs/tags/v')
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
- run: nix develop -c goreleaser release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: softprops/action-gh-release@v1
with:
files: "*.deb"

28
.goreleaser.yaml Normal file
View File

@ -0,0 +1,28 @@
builds:
- id: debanator
main: ./cmd/main.go
ldflags:
- -s -w
- -X github.com/wlcx/debanator.Version={{.Version}}
- -X github.com/wlcx/debanator.Commit={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- arm
- arm64
- amd64
goarm:
- 7
nfpms:
- id: debanator
package_name: debanator
vendor: wlcx industries
builds:
- debanator
maintainer: Sam W <sam@wlcx.cc>
formats:
- deb

View File

@ -30,7 +30,7 @@
apps.default = utils.lib.mkApp {drv = packages.default;}; apps.default = utils.lib.mkApp {drv = packages.default;};
devShells.default = devShells.default =
pkgs.devshell.mkShell {packages = with pkgs; [go gopls];}; pkgs.devshell.mkShell {packages = with pkgs; [go gopls goreleaser];};
formatter = pkgs.alejandra; formatter = pkgs.alejandra;
}); });
} }