From b9e0b7303c1fd11d51c10c2e58561cfb4d196898 Mon Sep 17 00:00:00 2001 From: Evan Wies Date: Sat, 20 Jan 2024 22:13:58 -0500 Subject: [PATCH] add CI/CD --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ .gitignore | 3 ++- .goreleaser.yml | 44 +++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a766314 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: goreleaser + +on: + pull_request: + push: + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '>=1.20.1' + - + name: Build with GoReleaser on main + uses: goreleaser/goreleaser-action@v4 + if: github.ref == 'refs/heads/main' + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: build --clean --snapshot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + - + name: Publish with GoReleaser on tags + uses: goreleaser/goreleaser-action@v4 + if: startsWith(github.ref, 'refs/tags/') + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.gitignore b/.gitignore index 2d5c2e0..6e4f001 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,5 @@ TODO.md ./idea *.iml -.task \ No newline at end of file +.task +dist diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..406a2e8 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,44 @@ +# nomad-onload .goreleaser.yml +# Copyright (c) 2024 Neomantra BV +# Documentation at http://goreleaser.com + +project_name: nomad-onload + +before: + hooks: + - go mod tidy + +builds: + - main: ./cmd/nomad-device-onload + id: nomad-device-onload + binary: nomad-device-onload + env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 +archives: + - id: nomad-device-onload + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +universal_binaries: + - replace: true + +release: + github: + owner: neomantra + name: nomad-device-onload