Skip to content

Commit

Permalink
chore: add docker build&publish in .goreleaser.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotxx committed Oct 20, 2021
1 parent a455474 commit 62dce9f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Login to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
34 changes: 33 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ changelog:
exclude:
- '^docs:'
- '^test:'

release:
github:
owner: elliotxx
Expand All @@ -41,4 +42,35 @@ release:
- Item 1
- Item 2
footer: |
## Thanks!
## Thanks!
dockers:
- image_templates:
- 'elliotxx/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}'
- 'elliotxx/{{ .ProjectName }}:latest'
- 'ghcr.io/elliotxx/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}'
- 'ghcr.io/elliotxx/{{ .ProjectName }}:latest'
dockerfile: Dockerfile
use: docker
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- image_templates:
- 'elliotxx/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-arm64'
- 'ghcr.io/elliotxx/{{ .ProjectName }}:{{ .Tag }}-{{ .ShortCommit }}-arm64'
dockerfile: Dockerfile
use: docker
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
goarch: arm64

0 comments on commit 62dce9f

Please sign in to comment.