ci: Ajout du workflow Gitea pour le tag 'ext'
All checks were successful
build-and-push-ext / build_push (push) Successful in 3m49s
All checks were successful
build-and-push-ext / build_push (push) Successful in 3m49s
- Création de .gitea/workflows/build-ext.yml - Workflow déclenché sur push du tag 'ext' - Build et push de l'image sdk_storage:ext - Configuration SSH et Docker registry
This commit is contained in:
parent
a2c19e7e9e
commit
a4fa790021
60
.gitea/workflows/build-ext.yml
Normal file
60
.gitea/workflows/build-ext.yml
Normal file
@ -0,0 +1,60 @@
|
||||
name: build-and-push-ext
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- ext
|
||||
|
||||
jobs:
|
||||
build_push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare SSH agent (optional)
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
eval "$(ssh-agent -s)"
|
||||
if [ -n "${{ secrets.SSH_PRIVATE_KEY || '' }}" ]; then
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' | ssh-add - >/dev/null 2>&1 || true
|
||||
fi
|
||||
mkdir -p ~/.ssh
|
||||
ssh-keyscan git.4nkweb.com >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
echo "SSH agent ready: $SSH_AUTH_SOCK"
|
||||
# Rendre l'agent dispo aux steps suivants
|
||||
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> "$GITHUB_ENV"
|
||||
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Docker login (git.4nkweb.com)
|
||||
shell: bash
|
||||
env:
|
||||
REG_USER: ${{ secrets.USER }}
|
||||
REG_TOKEN: ${{ secrets.TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "$REG_TOKEN" | docker login git.4nkweb.com -u "$REG_USER" --password-stdin
|
||||
|
||||
- name: Build image (target ext)
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -n "${SSH_AUTH_SOCK:-}" ]; then
|
||||
docker build --ssh default \
|
||||
-t git.4nkweb.com/4nk/sdk_storage:ext \
|
||||
-f Dockerfile .
|
||||
else
|
||||
echo "SSH_AUTH_SOCK non défini: l'agent SSH n'est pas disponible. Assurez-vous de définir secrets.SSH_PRIVATE_KEY."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Push image
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker push git.4nkweb.com/4nk/sdk_storage:ext
|
Loading…
x
Reference in New Issue
Block a user