fix: replace actions/checkout with manual git clone (no Node dependency)

This commit is contained in:
2025-12-07 17:56:16 +00:00
parent 6f4b8a203f
commit 9d816609b2

View File

@@ -29,9 +29,10 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: apk add --no-cache git jq run: apk add --no-cache git jq
- uses: actions/checkout@v3 - name: Checkout repository
with: run: |
fetch-depth: 2 git clone --depth 2 https://gitea.arnodo.fr/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }}
- name: Detect changed images - name: Detect changed images
id: changes id: changes
@@ -72,19 +73,30 @@ jobs:
matrix: matrix:
image: ${{ fromJson(needs.detect-changes.outputs.matrix) }} image: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v3 - name: Install git
run: |
# buildkit image is based on Alpine
cat /etc/os-release || true
apk add --no-cache git || apt-get update && apt-get install -y git || true
- name: Checkout repository
run: |
git clone --depth 1 https://gitea.arnodo.fr/${{ gitea.repository }}.git /workspace
cd /workspace
git checkout ${{ gitea.sha }} || true
- name: Build and push with Buildkit - name: Build and push with Buildkit
env: env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
REGISTRY_USER: ${{ gitea.actor }} REGISTRY_USER: ${{ gitea.actor }}
run: | run: |
cd /workspace
IMAGE_NAME="${{ env.REGISTRY }}/damien/${{ matrix.image }}" IMAGE_NAME="${{ env.REGISTRY }}/damien/${{ matrix.image }}"
SHORT_SHA=$(echo "${{ gitea.sha }}" | cut -c1-7) SHORT_SHA=$(echo "${{ gitea.sha }}" | cut -c1-7)
# Create auth config for registry # Create auth config for registry
mkdir -p ~/.docker mkdir -p ~/.docker
AUTH=$(echo -n "${REGISTRY_USER}:${REGISTRY_TOKEN}" | base64) AUTH=$(echo -n "${REGISTRY_USER}:${REGISTRY_TOKEN}" | base64 | tr -d '\n')
cat > ~/.docker/config.json <<EOF cat > ~/.docker/config.json <<EOF
{ {
"auths": { "auths": {
@@ -95,6 +107,8 @@ jobs:
} }
EOF EOF
echo "Building ${IMAGE_NAME}..."
# Build and push with buildctl # Build and push with buildctl
buildctl-daemonless.sh build \ buildctl-daemonless.sh build \
--frontend dockerfile.v0 \ --frontend dockerfile.v0 \