Skip to content

Commit

Permalink
Fix release action
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
kakkoyun committed Jun 9, 2022
1 parent 488b052 commit 307a130
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
40 changes: 11 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ jobs:
with:
go-version: ^1.18

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Docker Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -31,32 +41,4 @@ jobs:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

container:
name: Container build and release
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Get branch name
shell: bash
run: echo "GITHUB_BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Build container
run: make container

- name: Login to registry
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | docker login -u kakkoyun--password-stdin ghcr.io
- name: Push container
if: ${{ github.event_name != 'pull_request' }}
run: |
make push-container
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
12 changes: 7 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ release:
footer: |
## Docker images
`docker pull ghcr.io/kakkoyun/split-debug:{{ .Tag }}`
`docker pull ghcr.io/kakkoyun/{{ .ProjectName }}:{{ .Tag }}`
## Thanks!
Expand All @@ -57,9 +57,10 @@ changelog:
dockers:
# https://goreleaser.com/customization/docker/
- id: amd64
use: buildx
image_templates:
- kakkoyun/{{ .ProjectName }}:{{ .Version }}-amd64
- kakkoyun/{{ .ProjectName }}:latest-amd64
- ghcr.io/kakkoyun/{{ .ProjectName }}:{{ .Version }}-amd64
- ghcr.io/kakkoyun/{{ .ProjectName }}:latest-amd64
dockerfile: Dockerfile.release
build_flag_templates:
- --platform=linux/amd64
Expand All @@ -73,9 +74,10 @@ dockers:
- --label=org.opencontainers.image.licenses=Apache-2.0

- id: arm64
use: buildx
image_templates:
- kakkoyun/{{ .ProjectName }}:{{ .Version }}-arm64v8
- kakkoyun/{{ .ProjectName }}:latest-arm64v8
- ghcr.io/kakkoyun/{{ .ProjectName }}:{{ .Version }}-arm64v8
- ghcr.io/kakkoyun/{{ .ProjectName }}:latest-arm64v8
goarch: arm64
dockerfile: Dockerfile.release
build_flag_templates:
Expand Down

0 comments on commit 307a130

Please sign in to comment.