Update CI/CD to build the image with the appropriate tag

This commit is contained in:
Deon George 2025-03-03 16:52:53 +11:00
parent a59bbc8790
commit 4dd41d1309

View File

@ -2,7 +2,7 @@ name: Create Docker Image
run-name: ${{ gitea.actor }} Building Docker Image 🐳 run-name: ${{ gitea.actor }} Building Docker Image 🐳
on: [push] on: [push]
env: env:
VERSION: latest VERSION: ${{ env.GITHUB_REF_NAME }}
DOCKER_HOST: tcp://127.0.0.1:2375 DOCKER_HOST: tcp://127.0.0.1:2375
jobs: jobs:
@ -145,12 +145,11 @@ jobs:
- name: Record version and Delete Unnecessary files - name: Record version and Delete Unnecessary files
id: prebuild id: prebuild
run: | run: |
echo "version=$(cat public/VERSION)" >> "$GITHUB_OUTPUT"
echo "revision=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
echo ${GITHUB_SHA::8} > VERSION echo ${GITHUB_SHA::8} > VERSION
[ "${{ env.GITHUB_REF_TYPE }}" -eq "tag" ] && echo v${{ env.VERSION }}-rel > public/VERSION
rm -rf .git* tests/ storage/app/test/ rm -rf .git* tests/ storage/app/test/
ls -al public/css/ # ls -al public/css/
ls -al public/js/ # ls -al public/js/
- name: Build and Push Docker Image - name: Build and Push Docker Image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
@ -160,8 +159,8 @@ jobs:
push: true push: true
tags: "${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSIONARCH }}" tags: "${{ steps.registry.outputs.registry }}/${{ env.GITHUB_REPOSITORY }}:${{ env.VERSIONARCH }}"
build-args: | build-args: |
BUILD_REVISION=${{ steps.prebuild.outputs.revision }} BUILD_REVISION=${{ env.GITHUB_SHA }}
BUILD_VERSION=${{ steps.prebuild.outputs.version }} BUILD_VERSION=v${{ env.VERSION }}
manifest: manifest:
name: Final Docker Image Manifest name: Final Docker Image Manifest