Files
geo/.gitea/workflows/offline-package.yml
T
root 22163edbee
CI / Backend (push) Failing after 8m3s
CI / Deployment Config (push) Successful in 6s
CI / Frontend (push) Successful in 4m4s
chore(ci): add offline container deployment pipeline
2026-04-30 23:29:15 +08:00

94 lines
2.9 KiB
YAML

name: Offline Package
on:
workflow_dispatch:
inputs:
image_tag:
description: "Docker image tag. Defaults to the current tag name or short commit SHA."
required: false
default: ""
platform:
description: "Target platform for the offline package."
required: false
default: "linux/amd64"
push:
tags:
- "v*"
permissions:
contents: read
jobs:
package:
name: Build Offline Package
runs-on: ubuntu-latest
timeout-minutes: 180
env:
DOCKER_BUILDKIT: "1"
REQUESTED_IMAGE_TAG: ${{ inputs.image_tag }}
REQUESTED_PLATFORM: ${{ inputs.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Docker CLI and buildx
run: |
if command -v docker >/dev/null 2>&1 && docker buildx version >/dev/null 2>&1; then
docker version
docker buildx version
exit 0
fi
apt-get update
apt-get install -y ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
. /etc/os-release
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu ${VERSION_CODENAME} stable" > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-ce-cli docker-buildx-plugin docker-compose-plugin
docker version
docker buildx version
- name: Check Docker daemon
run: docker info
- name: Resolve package metadata
run: |
image_tag="${REQUESTED_IMAGE_TAG}"
if [ -z "${image_tag}" ]; then
case "${GITHUB_REF:-}" in
refs/tags/*)
image_tag="${GITHUB_REF#refs/tags/}"
;;
*)
image_tag="$(git rev-parse --short=12 HEAD)"
;;
esac
fi
platform="${REQUESTED_PLATFORM:-linux/amd64}"
printf '%s\n' "${image_tag}" > .ci-image-tag
printf '%s\n' "${platform}" > .ci-platform
echo "Image tag: ${image_tag}"
echo "Platform: ${platform}"
- name: Build offline deployment package
run: |
image_tag="$(cat .ci-image-tag)"
platform="$(cat .ci-platform)"
mkdir -p artifacts
PACKAGE_OUTPUT_DIR="${PWD}/artifacts" bash deploy/scripts/package.sh "${image_tag}" "${platform}"
ls -lh artifacts
- name: Upload offline package
uses: actions/upload-artifact@v3
with:
name: geo-rankly-offline-package
path: |
artifacts/*.tar.gz
artifacts/*.sha256
if-no-files-found: error
retention-days: 14