Skip to content

refactor(configuration): Update server configuration file handling an… #22

refactor(configuration): Update server configuration file handling an…

refactor(configuration): Update server configuration file handling an… #22

name: Docker GHCR
permissions:
contents: write
packages: write
pull-requests: write
on:
push:
branches:
- main
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: vnyan-server-docker
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set image refs
shell: bash
run: |
owner_lower="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
echo "IMAGE_OWNER_LOWER=${owner_lower}" >> $GITHUB_ENV
echo "IMAGE_REF=${REGISTRY}/${owner_lower}/${IMAGE_NAME}" >> $GITHUB_ENV
# --- GHCR login ---
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine version
id: version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION=latest
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and push Docker image (multi-arch)
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_REF }}:${{ env.VERSION }}
${{ env.IMAGE_REF }}:latest
build-args: |
VNYAN_VERSION=${{ env.VERSION }}