docs: update README and CI workflow to clarify Gitea Registry login process and improve Docker image build conditions, including handling of secrets and environment variables
CI / changes (push) Successful in 5s
CI / go (push) Successful in 19s
CI / openapi (push) Has been skipped
CI / bird2 (push) Successful in 15s
CI / docker-images (deploy/docker/bird2/Dockerfile, evobgp-bird2) (push) Successful in 45s
CI / docker-images (deploy/docker/evobgp-agent/Dockerfile, evobgp-agent) (push) Successful in 1m6s
CI / docker-images (deploy/docker/evobgp-web/Dockerfile, evobgp-web) (push) Successful in 50s
CI / docker-images (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, evobgp-api) (push) Successful in 1m25s
CI / docker-images (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, evobgp-deploy) (push) Successful in 1m27s
CI / docker-images (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, evobgp-ingest) (push) Successful in 1m28s
CI / docker-images (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, evobgp-node) (push) Successful in 1m15s
CI / docker-images (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, evobgp-render) (push) Successful in 1m20s
CI / docker-images (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, evobgp-scheduler) (push) Successful in 1m26s
CI / docker-images (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, evobgp-all) (push) Successful in 1m27s
CI / changes (push) Successful in 5s
CI / go (push) Successful in 19s
CI / openapi (push) Has been skipped
CI / bird2 (push) Successful in 15s
CI / docker-images (deploy/docker/bird2/Dockerfile, evobgp-bird2) (push) Successful in 45s
CI / docker-images (deploy/docker/evobgp-agent/Dockerfile, evobgp-agent) (push) Successful in 1m6s
CI / docker-images (deploy/docker/evobgp-web/Dockerfile, evobgp-web) (push) Successful in 50s
CI / docker-images (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, evobgp-api) (push) Successful in 1m25s
CI / docker-images (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, evobgp-deploy) (push) Successful in 1m27s
CI / docker-images (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, evobgp-ingest) (push) Successful in 1m28s
CI / docker-images (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, evobgp-node) (push) Successful in 1m15s
CI / docker-images (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, evobgp-render) (push) Successful in 1m20s
CI / docker-images (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, evobgp-scheduler) (push) Successful in 1m26s
CI / docker-images (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, evobgp-all) (push) Successful in 1m27s
This commit is contained in:
@@ -161,43 +161,30 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Prepare registry (REGISTRY in env + outputs)
|
||||
- name: Prepare image metadata
|
||||
id: meta
|
||||
env:
|
||||
HOST: ${{ secrets.GITEA_REGISTRY_HOST }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
owner_lc="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')"
|
||||
echo "owner_lc=$owner_lc" >> "$GITHUB_OUTPUT"
|
||||
short_sha="$(echo '${{ github.sha }}' | cut -c1-7)"
|
||||
echo "short_sha=$short_sha" >> "$GITHUB_OUTPUT"
|
||||
if [ -z "${HOST:-}" ]; then
|
||||
echo "GITEA_REGISTRY_HOST not set — build without push."
|
||||
echo "docker_push=false" >> "$GITHUB_OUTPUT"
|
||||
echo "REGISTRY=" >> "$GITHUB_ENV"
|
||||
else
|
||||
h="$HOST"
|
||||
h="${h#https://}"
|
||||
h="${h#http://}"
|
||||
h="${h%/}"
|
||||
echo "docker_push=true" >> "$GITHUB_OUTPUT"
|
||||
echo "REGISTRY=$h" >> "$GITHUB_ENV"
|
||||
fi
|
||||
echo "docker_push=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
if: steps.meta.outputs.docker_push == 'true' && secrets.ACTIONS_PAT != ''
|
||||
if: steps.meta.outputs.docker_push == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
registry: git.shts.su
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.ACTIONS_PAT }}
|
||||
# PAT репозитория или встроенный токен job (нужны права на пакеты в настройках Actions).
|
||||
password: ${{ secrets.ACTIONS_PAT || gitea.token }}
|
||||
|
||||
- name: Build and push ${{ matrix.image }}
|
||||
env:
|
||||
OWNER_LC: ${{ steps.meta.outputs.owner_lc }}
|
||||
SHORT_SHA: ${{ steps.meta.outputs.short_sha }}
|
||||
DO_PUSH: ${{ steps.meta.outputs.docker_push }}
|
||||
PAT_OK: ${{ secrets.ACTIONS_PAT != '' }}
|
||||
DF: ${{ matrix.dockerfile }}
|
||||
IMAGE: ${{ matrix.image }}
|
||||
BIN: ${{ matrix.bin }}
|
||||
@@ -214,8 +201,8 @@ jobs:
|
||||
BUILD_ARGS+=(--build-arg "INSTALL_BIRDC=${BIRDC:-0}")
|
||||
fi
|
||||
|
||||
if [ "$DO_PUSH" = "true" ] && [ -n "${REGISTRY:-}" ] && [ "$PAT_OK" = "true" ]; then
|
||||
IMG="${REGISTRY}/${OWNER_LC}/${IMAGE}"
|
||||
if [ "$DO_PUSH" = "true" ]; then
|
||||
IMG="git.shts.su/${OWNER_LC}/${IMAGE}"
|
||||
docker buildx build \
|
||||
--platform linux/amd64 \
|
||||
--file "$DF" \
|
||||
|
||||
Reference in New Issue
Block a user