Skip to content

chore(deps): update frontend-deps (#459) #799

chore(deps): update frontend-deps (#459)

chore(deps): update frontend-deps (#459) #799

Workflow file for this run

name: Docker Image
on:
push:
branches:
- 'main'
- 'develop'
tags:
- v*
workflow_dispatch:
env:
MAIN_IMAGE: ghcr.io/meshaddicts/meshinfo
SPA_IMAGE: ghcr.io/meshaddicts/meshinfo-spa
jobs:
# ──────────────────────────────────────────────
# Main Image (backend / Python)
# ──────────────────────────────────────────────
build-main-amd64:
name: Build Main (amd64)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Gather Version Info to JSON File
run: |
cat << EOF > version-info.json
{
"run_id": "${{ github.run_id }}",
"run_number": ${{ github.run_number }},
"sha": "${{ github.sha }}",
"ref": "${{ github.ref }}",
"ref_name": "${{ github.ref_name }}",
"workflow": "${{ github.workflow }}",
"job": "${{ github.job }}",
"event_name": "${{ github.event_name }}",
"repository": "${{ github.repository }}",
"actor": "${{ github.actor }}"
}
EOF
- name: Generate version.json
run: |
REF="${{ github.ref_name }}"
REF="${REF#v}"
if [[ "$REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION="$REF"
MAJOR=$(echo "$REF" | cut -d. -f1)
MINOR=$(echo "$REF" | cut -d. -f2)
PATCH=$(echo "$REF" | cut -d. -f3)
else
VERSION="$REF-dev"
MAJOR=0
MINOR=0
PATCH=0
fi
jq -n \
--arg version "$VERSION" \
--argjson major "$MAJOR" \
--argjson minor "$MINOR" \
--argjson patch "$PATCH" \
--arg build_date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--arg git_sha "${GITHUB_SHA::7}" \
'{version:$version,major:$major,minor:$minor,patch:$patch,build_date_iso_8601:$build_date,git_sha:$git_sha}' \
> version.json
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
outputs: type=image,name=${{ env.MAIN_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=main-amd64
cache-to: type=gha,scope=main-amd64,mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: main-digests-amd64
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
build-main-arm64:
name: Build Main (arm64)
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Gather Version Info to JSON File
run: |
cat << EOF > version-info.json
{
"run_id": "${{ github.run_id }}",
"run_number": ${{ github.run_number }},
"sha": "${{ github.sha }}",
"ref": "${{ github.ref }}",
"ref_name": "${{ github.ref_name }}",
"workflow": "${{ github.workflow }}",
"job": "${{ github.job }}",
"event_name": "${{ github.event_name }}",
"repository": "${{ github.repository }}",
"actor": "${{ github.actor }}"
}
EOF
- name: Generate version.json
run: |
REF="${{ github.ref_name }}"
REF="${REF#v}"
if [[ "$REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION="$REF"
MAJOR=$(echo "$REF" | cut -d. -f1)
MINOR=$(echo "$REF" | cut -d. -f2)
PATCH=$(echo "$REF" | cut -d. -f3)
else
VERSION="$REF-dev"
MAJOR=0
MINOR=0
PATCH=0
fi
jq -n \
--arg version "$VERSION" \
--argjson major "$MAJOR" \
--argjson minor "$MINOR" \
--argjson patch "$PATCH" \
--arg build_date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--arg git_sha "${GITHUB_SHA::7}" \
'{version:$version,major:$major,minor:$minor,patch:$patch,build_date_iso_8601:$build_date,git_sha:$git_sha}' \
> version.json
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/arm64
outputs: type=image,name=${{ env.MAIN_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=main-arm64
cache-to: type=gha,scope=main-arm64,mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: main-digests-arm64
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge-main:
name: Merge Main Manifest
runs-on: ubuntu-latest
needs:
- build-main-amd64
- build-main-arm64
permissions:
contents: read
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v8
with:
path: /tmp/digests
pattern: main-digests-*
merge-multiple: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ env.MAIN_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.MAIN_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.MAIN_IMAGE }}:${{ steps.meta.outputs.version }}
# ──────────────────────────────────────────────
# SPA Image (frontend / Node)
# ──────────────────────────────────────────────
build-spa-amd64:
name: Build SPA (amd64)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Gather Version Info to JSON File
run: |
cat << EOF > version-info.json
{
"run_id": "${{ github.run_id }}",
"run_number": ${{ github.run_number }},
"sha": "${{ github.sha }}",
"ref": "${{ github.ref }}",
"ref_name": "${{ github.ref_name }}",
"workflow": "${{ github.workflow }}",
"job": "${{ github.job }}",
"event_name": "${{ github.event_name }}",
"repository": "${{ github.repository }}",
"actor": "${{ github.actor }}"
}
EOF
- name: Generate version.json
run: |
REF="${{ github.ref_name }}"
REF="${REF#v}"
if [[ "$REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION="$REF"
MAJOR=$(echo "$REF" | cut -d. -f1)
MINOR=$(echo "$REF" | cut -d. -f2)
PATCH=$(echo "$REF" | cut -d. -f3)
else
VERSION="$REF-dev"
MAJOR=0
MINOR=0
PATCH=0
fi
jq -n \
--arg version "$VERSION" \
--argjson major "$MAJOR" \
--argjson minor "$MINOR" \
--argjson patch "$PATCH" \
--arg build_date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--arg git_sha "${GITHUB_SHA::7}" \
'{version:$version,major:$major,minor:$minor,patch:$patch,build_date_iso_8601:$build_date,git_sha:$git_sha}' \
> version.json
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.spa
platforms: linux/amd64
outputs: type=image,name=${{ env.SPA_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=spa-amd64
cache-to: type=gha,scope=spa-amd64,mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: spa-digests-amd64
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
build-spa-arm64:
name: Build SPA (arm64)
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Gather Version Info to JSON File
run: |
cat << EOF > version-info.json
{
"run_id": "${{ github.run_id }}",
"run_number": ${{ github.run_number }},
"sha": "${{ github.sha }}",
"ref": "${{ github.ref }}",
"ref_name": "${{ github.ref_name }}",
"workflow": "${{ github.workflow }}",
"job": "${{ github.job }}",
"event_name": "${{ github.event_name }}",
"repository": "${{ github.repository }}",
"actor": "${{ github.actor }}"
}
EOF
- name: Generate version.json
run: |
REF="${{ github.ref_name }}"
REF="${REF#v}"
if [[ "$REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION="$REF"
MAJOR=$(echo "$REF" | cut -d. -f1)
MINOR=$(echo "$REF" | cut -d. -f2)
PATCH=$(echo "$REF" | cut -d. -f3)
else
VERSION="$REF-dev"
MAJOR=0
MINOR=0
PATCH=0
fi
jq -n \
--arg version "$VERSION" \
--argjson major "$MAJOR" \
--argjson minor "$MINOR" \
--argjson patch "$PATCH" \
--arg build_date "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--arg git_sha "${GITHUB_SHA::7}" \
'{version:$version,major:$major,minor:$minor,patch:$patch,build_date_iso_8601:$build_date,git_sha:$git_sha}' \
> version.json
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile.spa
platforms: linux/arm64
outputs: type=image,name=${{ env.SPA_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=spa-arm64
cache-to: type=gha,scope=spa-arm64,mode=max
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: spa-digests-arm64
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge-spa:
name: Merge SPA Manifest
runs-on: ubuntu-latest
needs:
- build-spa-amd64
- build-spa-arm64
permissions:
contents: read
packages: write
steps:
- name: Download digests
uses: actions/download-artifact@v8
with:
path: /tmp/digests
pattern: spa-digests-*
merge-multiple: true
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ env.SPA_IMAGE }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.SPA_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.SPA_IMAGE }}:${{ steps.meta.outputs.version }}