diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..67ab567 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 }} diff --git a/.gitignore b/.gitignore index 29e94ec..d81c1f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +dist/ docker-credential-env diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..b02fdcf --- /dev/null +++ b/.goreleaser.yaml @@ -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.