diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a12e2c5..f75afc1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,22 +6,17 @@ on: - main pull_request: +permissions: + contents: write # create releases + packages: write # push to ghcr + jobs: release: runs-on: ubuntu-latest - env: - DOCKER_CLI_EXPERIMENTAL: "enabled" steps: - uses: WillAbides/setup-go-faster@v1.13.0 with: - go-version: ^1.18 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + go-version: ^1.21.5 - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -47,4 +42,3 @@ jobs: args: release --clean ${{ env.GORELEASER_FLAGS }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPOSITORY_OWNER: ${{ github.repository_owner }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9175629..d872f09 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,3 +1,5 @@ +env: + - KO_DOCKER_REPO=ghcr.io/{{ .Env.GITHUB_REPOSITORY }} before: hooks: - go mod tidy @@ -19,36 +21,13 @@ archives: - format_overrides: - goos: windows format: zip -changelog: - skip: true -dockers: - - image_templates: - - "ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }}-amd64" - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --platform=linux/amd64 - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - image_templates: - - "ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }}-arm64v8" - goarch: arm64 - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --platform=linux/arm64/v8 - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} -docker_manifests: - - name_template: ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }} - image_templates: - - ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }}-amd64 - - ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }}-arm64v8 - - name_template: ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:latest - image_templates: - - ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }}-amd64 - - ghcr.io/{{ .Env.REPOSITORY_OWNER }}/{{ .ProjectName }}:{{ .Version }}-arm64v8 +kos: + - base_image: cgr.dev/chainguard/static + bare: true + platforms: + - linux/amd64 + - linux/arm64 + tags: + - latest + - "{{.Tag}}" + creation_time: "{{.CommitTimestamp}}"