Skip to content

Commit

Permalink
add CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
neomantra committed Jan 21, 2024
1 parent af74ecd commit b9e0b73
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ TODO.md
./idea
*.iml

.task
.task
dist
44 changes: 44 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b9e0b73

Please sign in to comment.