name: Build Blog Docker Image on: push: branches: - main jobs: # No space in the job id: it is interpolated verbatim into the podman network # name, and podman rejects [a-zA-Z0-9][a-zA-Z0-9_.-]* violations that docker let through. build-docker: runs-on: ubuntu-latest env: IMAGE: git.d3vyce.fr/${{ github.repository }}:latest steps: - name: Checkout code uses: actions/checkout@v7 # actions/checkout#1830 # with: # lfs: 'true' - name: Checkout LFS run: | function EscapeForwardSlash() { echo "$1" | sed 's/\//\\\//g'; } readonly ReplaceStr="EscapeForwardSlash ${{ gitea.repository }}.git/info/lfs/objects/batch"; sed -i "s/\(\[http\)\( \".*\)\"\]/\1\2`$ReplaceStr`\"]/" .git/config /usr/bin/git lfs fetch origin refs/remotes/origin/${{ gitea.ref_name }} /usr/bin/git lfs checkout - name: Verify LFS objects resolved run: | # A failed fetch leaves pointer files behind and hugo only dies later on # .Resize with "image: unknown format". Fail here, where the cause is legible. if git lfs ls-files | awk '$2 == "-"' | grep -q .; then echo "::error::LFS objects missing - these are still pointer files:" git lfs ls-files | awk '$2 == "-" { print " " $3 }' exit 1 fi - name: Install buildah run: | apt-get update && apt-get install -y buildah - name: Build and push run: | buildah login -u "${{ github.actor }}" -p "${{ secrets.GIT_TOKEN }}" git.d3vyce.fr buildah --storage-driver vfs build --isolation chroot -t "$IMAGE" -f ./Dockerfile . buildah --storage-driver vfs push "$IMAGE"