ci(gitea): build+push image ext via USER/TOKEN et docker_tag
Some checks failed
build-and-push-ext / build_push (push) Failing after 5s
Some checks failed
build-and-push-ext / build_push (push) Failing after 5s
This commit is contained in:
parent
ed982620de
commit
3aaf543175
64
.gitea/workflows/build-ext.yml
Normal file
64
.gitea/workflows/build-ext.yml
Normal file
@ -0,0 +1,64 @@
|
||||
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 (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"
|
||||
|
||||
- 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="dev-test"
|
||||
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: Build image (target ext)
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker build --target ext --ssh default -t git.4nkweb.com/4nk/lecoffre-front:${{ steps.tag.outputs.TAG }} -f Dockerfile .
|
||||
|
||||
- name: Push image
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker push git.4nkweb.com/4nk/lecoffre-front:${{ steps.tag.outputs.TAG }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user