Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
@@ -17,6 +17,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Set Registry Domain
|
||||
# Extracts the registry domain from the server URL
|
||||
run: |
|
||||
REGISTRY_DOMAIN=$(echo "${{ github.server_url }}" | sed 's|https://||' | sed 's|http://||')
|
||||
echo "REGISTRY_DOMAIN=$REGISTRY_DOMAIN" >> $GITHUB_ENV
|
||||
@@ -28,6 +29,10 @@ jobs:
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set version tags from Dockerfile
|
||||
# Reads version from Dockerfile and sets MAJOR, MAJOR_MINOR, VERSION
|
||||
run: ./.gitea/workflows/version_env.sh
|
||||
|
||||
- name: Build and push Docker image (multi-arch)
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
@@ -35,4 +40,8 @@ jobs:
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:latest
|
||||
tags: |
|
||||
${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:latest
|
||||
${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.MAJOR }}
|
||||
${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.MAJOR_MINOR }}
|
||||
${{ env.REGISTRY_DOMAIN }}/${{ github.repository }}:${{ env.VERSION }}
|
||||
|
||||
11
.gitea/workflows/version_env.sh
Normal file
11
.gitea/workflows/version_env.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# version_env.sh: Reads the version from the Dockerfile and sets MAJOR, MAJOR_MINOR, VERSION as environment variables
|
||||
|
||||
VERSION=$(grep 'org.opencontainers.image.version' Dockerfile | cut -d'=' -f2 | tr -d '"')
|
||||
MAJOR=$(echo "$VERSION" | cut -d. -f1)
|
||||
MAJOR_MINOR=$(echo "$VERSION" | awk -F. '{print $1 "." $2}')
|
||||
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
|
||||
echo "MAJOR_MINOR=$MAJOR_MINOR" >> $GITHUB_ENV
|
||||
Reference in New Issue
Block a user