Skip to content

Commit

Permalink
Switch to goreleaser for container image deploy (#374)
Browse files Browse the repository at this point in the history
* Remove current container deploy workflow config

* Update goreleaser config and relase workflow for docker release support
  • Loading branch information
magneticstain authored Jan 21, 2024
1 parent ed3e564 commit 3f85441
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 47 deletions.
47 changes: 0 additions & 47 deletions .github/workflows/containers.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ permissions:
jobs:
goreleaser:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

outputs:
hashes: ${{ steps.hash.outputs.hashes }}
Expand All @@ -26,6 +29,19 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: stable

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GitHub Container Registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: goreleaser/goreleaser-action@v5
id: run-goreleaser
Expand Down
14 changes: 14 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
before:
hooks:
- go mod tidy

builds:
- binary: ip2cr
env:
Expand Down Expand Up @@ -39,6 +40,7 @@ changelog:
- '^[Mm]inor: '
- '^[Tt]est: '
- '^Merge '

release:
github:
owner: magneticstain
Expand Down Expand Up @@ -67,3 +69,15 @@ brews:
name: homebrew-ip2cr

token: "{{ .Env.HOMEBREW_GITHUB_TOKEN }}"
dockers:
- image_templates:
# Docker Hub
- "docker.io/magneticstain/{{.ProjectName}}:latest"
- "docker.io/magneticstain/{{.ProjectName}}:v{{ .Major }}"
- "docker.io/magneticstain/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}"
- "docker.io/magneticstain/{{.ProjectName}}:{{ .Tag }}"
# GitHub Container Registry
- "ghcr.io/magneticstain/{{.ProjectName}}:latest"
- "ghcr.io/magneticstain/{{.ProjectName}}:v{{ .Major }}"
- "ghcr.io/magneticstain/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}"
- "ghcr.io/magneticstain/{{.ProjectName}}:{{ .Tag }}"

0 comments on commit 3f85441

Please sign in to comment.