Skip to content

Initial commit

Initial commit #3

Workflow file for this run

name: "Build Image"
on:
push:
branches:
- "master"
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: The version to release
type: string
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Set release version
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]; then
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
elif [ "${{ github.event_name == 'workflow_dispatch' }}" = "true" ]; then
echo "RELEASE_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "Could not identify the release version."
exit 1
fi
- name: Set the commit hash
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Set the build timestamp
run: echo "BUILD_TIMESTAMP=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_ENV
- name: Login to Packages Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: "./Dockerfile"
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/arm64/v8,linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}
ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}-${{ env.COMMIT_HASH }}
ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}-${{ env.COMMIT_HASH }}-${{ env.BUILD_TIMESTAMP }}