chore: add updater image configuration to Docker workflow
- Introduced a new job for building and pushing an updater Docker image, dynamically setting its name based on the repository structure. - Updated existing image name configurations for frontend and backend to strip version numbers, ensuring cleaner image tags. - Enhanced the Docker workflow with steps for checking out the repository, configuring Buildx, and logging into the Gitea registry.
This commit is contained in:
@@ -22,7 +22,8 @@ jobs:
|
||||
set -euo pipefail
|
||||
owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')
|
||||
name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${name}-backend" >> "${GITHUB_ENV}"
|
||||
stem=$(printf '%s' "$name" | sed -E 's/-[0-9]+$//')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${stem}-backend" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Prepare backend build context
|
||||
shell: bash
|
||||
@@ -81,7 +82,8 @@ jobs:
|
||||
set -euo pipefail
|
||||
owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')
|
||||
name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${name}-frontend" >> "${GITHUB_ENV}"
|
||||
stem=$(printf '%s' "$name" | sed -E 's/-[0-9]+$//')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${stem}-frontend" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Prepare frontend build context
|
||||
shell: bash
|
||||
@@ -135,6 +137,50 @@ jobs:
|
||||
org.opencontainers.image.revision=${{ gitea.sha }}
|
||||
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
|
||||
|
||||
updater-image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure updater image name
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')
|
||||
name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')
|
||||
stem=$(printf '%s' "$name" | sed -E 's/-[0-9]+$//')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${stem}-updater" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.shts.su
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.ACTIONS_PAT }}
|
||||
|
||||
- name: Build and push updater image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: deploy/updater
|
||||
file: deploy/updater/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||
cache-from: type=gha,scope=updater
|
||||
cache-to: type=gha,mode=max,scope=updater
|
||||
labels: |
|
||||
org.opencontainers.image.title=mmapp-updater
|
||||
org.opencontainers.image.description=MikroTik Manager autonomous Docker updater
|
||||
org.opencontainers.image.version=latest
|
||||
org.opencontainers.image.revision=${{ gitea.sha }}
|
||||
org.opencontainers.image.created=${{ gitea.event.head_commit.timestamp }}
|
||||
|
||||
notify-webhook:
|
||||
if: ${{ secrets.DEPLOY_WEBHOOK_URL != '' }}
|
||||
needs:
|
||||
|
||||
Reference in New Issue
Block a user