Skip to content

Merge pull request #8 from podmortem/dependabot/github_actions/github… #2

Merge pull request #8 from podmortem/dependabot/github_actions/github…

Merge pull request #8 from podmortem/dependabot/github_actions/github… #2

Workflow file for this run

name: Release
on:
push:
tags: ['v*.*.*']
env:
IMAGE_NAME: podmortem-ai-interface
DOCKERFILE: ./src/main/docker/Dockerfile.native
DEP_STAGE: dependencies
jobs:
warm-cache:
runs-on: [self-hosted, linux]
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: ${{ matrix.runner }}
permissions: {contents: read, packages: write}
strategy:
matrix:
include:
- arch: amd64
platform: linux/amd64
runner: [self-hosted, linux]
- arch: arm64
platform: linux/arm64
runner: ubuntu-22.04-arm
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, linux]
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, linux]
permissions: {contents: write}
steps:
- name: Generate GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true