Skip to content

chore(ci): add release workflow #1

chore(ci): add release workflow

chore(ci): add release workflow #1

Workflow file for this run

name: Release
on:
push:
tags: ['v*.*.*']
env:
IMAGE_NAME: podmortem-log-parser
DOCKERFILE: ./src/main/docker/Dockerfile.native
DEP_STAGE: dependencies
jobs:
warm-cache:
runs-on: self-hosted
permissions: {contents: read, packages: write}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Build deps layer
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE }}
target: ${{ env.DEP_STAGE }}
push: true
platforms: linux/amd64
cache-from: type=gha,scope=deps
cache-to: |
type=gha,mode=max,scope=deps
type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:deps-cache,mode=max
tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:deps-cache
build-args: GITHUB_USER=${{ github.actor }}
secrets: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
build-arch:
needs: warm-cache
runs-on: self-hosted
permissions: {contents: read, packages: write}
strategy:
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
platform: linux/amd64
- arch: arm64
platform: linux/arm64
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Build & push ${{ matrix.arch }}
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.DOCKERFILE }}
platforms: ${{ matrix.platform }}
push: true
cache-from: |
type=gha,scope=deps
type=gha,scope=build-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ matrix.arch }}
build-args: GITHUB_USER=${{ github.actor }}
secrets: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
manifest:
needs: build-arch
runs-on: self-hosted
permissions: {contents: read, packages: write}
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: Create manifest list
run: |
for TAG in ${{ github.ref_name }} latest; do
docker buildx imagetools create \
-t ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${TAG} \
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-amd64 \
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-arm64
done
release-notes:
needs: manifest
runs-on: self-hosted
permissions: {contents: write}
steps:
- name: Generate GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true