Skip to content

Commit

Permalink
Build & release Docker image.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavpandeyvpz committed May 15, 2024
1 parent ffafc26 commit a72626c
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ on:
push:
tags: ["*"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

permissions:
contents: write
id-token: write
packages: write

jobs:
build:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ fromJSON(steps.release.outputs.metadata).version }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -20,8 +28,48 @@ jobs:
go-version: '1.21.x'
- name: Build & release
uses: goreleaser/goreleaser-action@v5
id: release
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

container:
name: Build Docker image
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install cosign
uses: sigstore/cosign-installer@v3.1.1
with:
cosign-release: v2.1.1
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2.9.1
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.6.0
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
tags: |
type=raw,value=${{ needs.release.outputs.version }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4.1.1
with:
context: .
platforms: linux/amd64,linux/arm64
push: 'true'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max=

0 comments on commit a72626c

Please sign in to comment.