diff --git a/.gitea/workflows/build-images.yml b/.gitea/workflows/build-images.yml index f07849a..f38342c 100644 --- a/.gitea/workflows/build-images.yml +++ b/.gitea/workflows/build-images.yml @@ -29,9 +29,10 @@ jobs: - name: Install dependencies run: apk add --no-cache git jq - - uses: actions/checkout@v3 - with: - fetch-depth: 2 + - name: Checkout repository + run: | + git clone --depth 2 https://gitea.arnodo.fr/${{ gitea.repository }}.git . + git checkout ${{ gitea.sha }} - name: Detect changed images id: changes @@ -72,19 +73,30 @@ jobs: matrix: image: ${{ fromJson(needs.detect-changes.outputs.matrix) }} 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 env: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} REGISTRY_USER: ${{ gitea.actor }} run: | + cd /workspace IMAGE_NAME="${{ env.REGISTRY }}/damien/${{ matrix.image }}" SHORT_SHA=$(echo "${{ gitea.sha }}" | cut -c1-7) # Create auth config for registry 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 <