ci: build-and-push ext (Gitea Actions)
Some checks failed
build-and-push-ext / build_push (push) Failing after 4s
Some checks failed
build-and-push-ext / build_push (push) Failing after 4s
This commit is contained in:
parent
4e17287f68
commit
7541bce346
80
.gitea/workflows/build-ext.yml
Normal file
80
.gitea/workflows/build-ext.yml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
name: build-and-push-ext
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev4
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Prepare SSH agent (for private deps)
|
||||||
|
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_AUTH_SOCK=$SSH_AUTH_SOCK" >> "$GITHUB_ENV"
|
||||||
|
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Compute Docker tag from commit message or fallback
|
||||||
|
id: tag
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
msg=$(git log -1 --pretty=%B)
|
||||||
|
if [[ "$msg" =~ ci:\ docker_tag=([a-zA-Z0-9._:-]+) ]]; then
|
||||||
|
tag="${BASH_REMATCH[1]}"
|
||||||
|
else
|
||||||
|
tag="ext"
|
||||||
|
fi
|
||||||
|
echo "TAG=$tag" | tee -a $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- 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: Load .env(.exemple) for build-time (optional)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
set -a
|
||||||
|
if [ -f .env ]; then . ./.env; elif [ -f .env.exemple ]; then . ./.env.exemple; fi
|
||||||
|
set +a
|
||||||
|
env | grep '^NEXT_PUBLIC_' || true
|
||||||
|
|
||||||
|
- name: Build image (ext)
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: "1"
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -n "${SSH_AUTH_SOCK:-}" ]; then
|
||||||
|
docker build --ssh default \
|
||||||
|
--target '' \
|
||||||
|
-t git.4nkweb.com/4nk/lecoffre-back-mini:${{ steps.tag.outputs.TAG }} \
|
||||||
|
-f Dockerfile .
|
||||||
|
else
|
||||||
|
echo "SSH agent not available (secrets.SSH_PRIVATE_KEY missing)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
docker push git.4nkweb.com/4nk/lecoffre-back-mini:${{ steps.tag.outputs.TAG }}
|
Loading…
x
Reference in New Issue
Block a user