Skip to content

Commit

Permalink
Updated workflow to publish docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
LumePart committed Oct 26, 2024
1 parent 257b943 commit fa2f9ed
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV
echo "GOOS=$GOOS" >> $GITHUB_ENV
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
- name: Build
- name: Build binary
run: |
go build -o "$BINARY_NAME" -v ./src/
- name: Release
Expand All @@ -62,3 +62,41 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
name: Build/publish container image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
needs: release

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/386

0 comments on commit fa2f9ed

Please sign in to comment.