Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add release automation #1

Merged
merged 1 commit into from
Jul 29, 2024
Merged
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
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release

on:
push:
# version tags are protected in this repository
tags:
- "v*"

permissions:
contents: write

jobs:
goreleaser:
# use an environment when releasing
environment: Publish

runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4
with:
# history is required to enable release notes generation
fetch-depth: 0

- name: Configure Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Release
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: v2.1.0
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
docker-credential-env
39 changes: 39 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2

builds:
- id: release
binary: docker-credential-env
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- '-s -w -X "main.Version={{.Version}}" -X "main.Revision={{.FullCommit}}"'
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64

checksum:
name_template: "checksums.txt"

archives:
- format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"

changelog:
use: github-native
sort: asc

release:
prerelease: auto
header: |
Distributions for this release are published as binaries below.

In order for Docker to be able to use the binary, it must be in the PATH, have the name `docker-credential-env`, and be executable by the required user. Note that it is sufficient to create an appropriately named symoblic link to make it discoverable by Docker.

Binaries are available for Mac, Linux and Windows.