Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 33 additions & 31 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
---
name: "Build release artifacts"

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: write
concurrency:
group: releaser
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-go@v5

- run: make dgoss-sha256 dcgoss-sha256 kgoss-sha256

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
check-latest: true
cache: true

- name: Get version from tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: echo "TRAVIS_TAG=${{ github.ref_name }}" >> $GITHUB_ENV

- run: make release
- run: make dgoss-sha256 dcgoss-sha256 kgoss-sha256
- name: Set up QEMU (for ARM64)
uses: docker/setup-qemu-action@v4
with:
platforms: arm64

- name: "Upload binary as artifact"
uses: actions/upload-artifact@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
retention-days: 5
if-no-files-found: error
name: build
path: |
release/*
extras/*/*goss
extras/*/*goss.sha256

attach-assets:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: ["build"]
runs-on: ubuntu-latest
steps:
- name: Fetch all binaries
uses: actions/download-artifact@v4
- name: Attach to release
uses: softprops/action-gh-release@v2
platforms: linux/amd64,linux/arm64

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
files: build/**
fail_on_unmatched_files: true
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
*.bak
/goss
/release
/dist
/integration-tests/goss/goss
/integration-tests/**/*-generated*
/vendor/
/integration-tests/**/goss-linux-386
/integration-tests/**/goss-linux-amd64
/extras/**/*.sha256

# Random stuff for my local testing/development that I don't want checked in
tmp/
Expand Down
108 changes: 108 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2

before:
hooks:
- go mod tidy

builds:
- id: binaries
binary: goss
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- "386"
- amd64
- arm
- arm64
- s390x
ignore:
- goos: windows
goarch: s390x
- goos: windows
goarch: "386"
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: darwin
goarch: s390x
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
main: ./cmd/goss
flags:
- -trimpath
ldflags:
- "-s -w -X github.com/goss-org/goss/util.Version={{ .Version }}"
mod_timestamp: "{{ .CommitTimestamp }}"

archives:
- formats:
- tar.gz
id: archives
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
formats:
- zip
files:
- LICENSE
- README.md

dockers_v2:
- id: images
ids:
- binaries
labels:
"org.opencontainers.image.created": "{{ .Date }}"
"org.opencontainers.image.description": "Quick and Easy server testing/validation"
"org.opencontainers.image.licenses": "Apache-2.0"
"org.opencontainers.image.revision": "{{ .FullCommit }}"
"org.opencontainers.image.source": "{{ .GitURL }}"
"org.opencontainers.image.title": "{{ .ProjectName }}"
"org.opencontainers.image.url": "{{ .GitURL }}"
"org.opencontainers.image.version": "{{ .Version }}"
platforms:
- linux/amd64
- linux/arm64
disable: "{{ .IsSnapshot }}"
images:
- "ghcr.io/goss-org/goss"
tags:
- "v{{ .Version }}"
- "{{ if .IsNightly }}nightly{{ end }}"
- "{{ if not .IsNightly }}latest{{ end }}"

checksum:
algorithm: sha256
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"

release:
extra_files:
- glob: ./extras/*goss/*goss*

snapshot:
version_template: "{{ incpatch .Version }}-next"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
18 changes: 3 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
ARG GO_VERSION=1.22
FROM alpine:3.23

FROM docker.io/golang:${GO_VERSION}-alpine AS base

ARG GOSS_VERSION=v0.0.0
WORKDIR /build

RUN --mount=target=. \
CGO_ENABLED=0 go build \
-ldflags "-X github.com/goss-org/goss/util.Version=${GOSS_VERSION} -s -w" \
-o "/release/goss" \
./cmd/goss

FROM alpine:3.19

COPY --from=base /release/* /usr/bin/
ARG TARGETPLATFORM
COPY $TARGETPLATFORM/goss /usr/bin/

RUN mkdir /goss
VOLUME /goss
Loading