diff --git a/.gitea/workflows/builder.yaml b/.gitea/workflows/builder.yaml new file mode 100644 index 0000000..927f678 --- /dev/null +++ b/.gitea/workflows/builder.yaml @@ -0,0 +1,48 @@ +name: Build & Push Builder Image + +on: + workflow_call: + inputs: + image: + description: "Full image name to build and push" + required: true + type: string + + username: + required: true + type: string + + secrets: + password: + required: true + + outputs: + tag: + description: "The built image reference" + value: ${{ jobs.builder.outputs.tag }} + +jobs: + builder: + runs-on: nix + outputs: + tag: ${{ steps.build.outputs.tag }} + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Log In to Registry + run: buildah login --username "${{ inputs.username }}" --password "${{ secrets.password }}" "$(echo "${{ inputs.image }}" | cut -d/ -f1)" + + - name: Pull Builder Cache + run: buildah pull ${{ inputs.image }} || true + + - name: Build Builder Image + id: build + run: | + buildah build --layers -f .gitea/Containerfile -t ${{ inputs.image }} . + digest=$(skopeo inspect containers-storage:${{ inputs.image }} | jq -r '.Digest') + ref="${{ inputs.image }}@${digest}" + echo "tag=$ref" >> $GITEA_OUTPUT + + - name: Push Builder Image + run: skopeo copy containers-storage:${{ inputs.image }} docker://${{ inputs.image }}