Skip to content

Commit

Permalink
ci: test go releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
y-eight committed Nov 30, 2023
1 parent 4b6b42c commit 53901de
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 21 deletions.
30 changes: 9 additions & 21 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ permissions:
contents: read

jobs:
binary:
name: Binary
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"

- name: Install dependencies
run: go get .

- name: Build
run: VERSION=${{ github.ref_name }} CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=${VERSION}" -o sparrow .

container-image:
name: Container image
runs-on: ubuntu-latest
Expand Down Expand Up @@ -127,3 +106,12 @@ jobs:
GO_VERSION=${{ steps.go-version.outputs.value }}
VERSION=${{ github.ref_name }}
if: inputs.push

- uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release
env: |
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
if: success() && inputs.releaseS

29 changes: 29 additions & 0 deletions .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release (Test)

on: [push]

permissions:
contents: read

jobs:
rel:
name: Release
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
id-token: write
security-events: write

steps:

- name: Checkout repository
uses: actions/checkout@v4

- uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release
env: |
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
30 changes: 30 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
project_name: example
builds:
- env: [CGO_ENABLED=0]
goos:
- linux
goarch:
- amd64
- arm64
dockers:
- image_templates: ["ghcr.io/caas-team/sparrow:{{ .Version }}"]
dockerfile: Dockerfile
build_flag_templates:
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://caas.telekom.de
- --label=org.opencontainers.image.source=https://github.com/caas-team/sparrow
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time.RFC3339 }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses="Apache 2.0"
nfpms:
- maintainer: CaaS <[email protected]>
description: |-
Monitoring tool to gather infrastructure network information
homepage: https://github.com/caas-team
license: Apache 2.0
formats:
- deb
- rpm
- apk

0 comments on commit 53901de

Please sign in to comment.