Skip to content

Container build

Container build #51

Workflow file for this run

name: Container build
on:
workflow_run:
workflows: ["Release Build"]
types:
- completed
permissions:
contents: read
packages: write
actions: read
env:
REGISTRY_IMAGE: ghcr.io/algorithm5838/redlib
jobs:
build:
runs-on: ubuntu-latest
# Only build if the Release Build succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download binary artifact from Release Build
uses: actions/download-artifact@v4
with:
name: redlib-aarch64-unknown-linux-musl
path: docker-bin/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Make binary executable
run: chmod +x docker-bin/redlib
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=sha,prefix=sha-,format=short,event=branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (ARM64)
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile.prebuilt
- name: Print image tags
run: |
echo "## Docker Image" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "docker pull ${{ env.REGISTRY_IMAGE }}:latest" >> $GITHUB_STEP_SUMMARY
echo "docker pull ${{ env.REGISTRY_IMAGE }}:sha-$(echo '${{ github.event.workflow_run.head_sha }}' | cut -c1-7)" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY