From 5cfb879462e21b0f0060bb971cc067fd89c1db6e Mon Sep 17 00:00:00 2001 From: Chris Ampenberger Date: Thu, 28 Aug 2025 13:00:38 -0400 Subject: [PATCH] Initial version --- .gitea/workflows/simple-container.yaml | 77 ++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .gitea/workflows/simple-container.yaml diff --git a/.gitea/workflows/simple-container.yaml b/.gitea/workflows/simple-container.yaml new file mode 100644 index 0000000..7f521e2 --- /dev/null +++ b/.gitea/workflows/simple-container.yaml @@ -0,0 +1,77 @@ +name: Build and Publisch a Simple Container + +on: + workflow_call: + inputs: + package-name: + required: true + type: string + package-label: + required: true + type: string + builder-image: + required: false + type: string + default: gitea.ampenberger.com/campenbe/img-builder:3.21-1.24 + + secrets: + PASSWORD: + required: true + GIT_TOKEN: + required: true + +env: + PACKAGE_NAME: ${{ inputs.package-name }} + LABEL: ${{ inputs.package-label }} + ARTIFACT_UPLOAD: ${{ env.ACT_EXEC == 'true' && 'actions/upload-artifact@v2' || 'actions/upload-artifact@v3' }} + ARTIFACT_DOWNLOAD: ${{ env.ACT_EXEC == 'true' && 'actions/download-artifact@v2' || 'actions/download-artifact@v3' }} + BUILDER_IMAGE: ${{ inputs.builder-image }} + +jobs: + + container: + runs-on: ubuntu-latest + container: + image: ${{env.BUILDER_IMAGE}} + credentials: + username: campenbe + password: ${{secrets.PASSWORD}} + + steps: + - name: Install tools + run : | + gitea_addr.sh + env | sort + + - name: Fix git access + run: | + git config --global url."https://git:${{secrets.GIT_TOKEN}}@gitea.ampenberger.com/campenbe/.insteadOf" git://git.ampenberger.com/ + + - uses: actions/checkout@v4 + with: + submodules: false + + - name: Build container + run: | + buildah build -f Dockerfile -t gitea.ampenberger.com/campenbe/${PACKAGE_NAME}:${LABEL} + + echo "Built ${PACKAGE_NAME}:${LABEL}" + buildah images + + - name: export the image + run: | + buildah push --format docker gitea.ampenberger.com/campenbe/${PACKAGE_NAME}:${LABEL} docker-archive:${PACKAGE_NAME}-${LABEL}.tar + echo "Exported gitea.ampenberger.com/campenbe/${PACKAGE_NAME}:${LABEL} to ${PACKAGE_NAME}-${LABEL}.tar" + + - name: Upload container image + uses: "${{env.ARTIFACT_UPLOAD}}" + with: + name: ${{env.PACKAGE_NAME}}-${{ env.LABEL }} + path: "${{env.PACKAGE_NAME}}-${{ env.LABEL }}.tar" + if-no-files-found: error + compression-level: 0 + + - name: Publish the container to the registry + run: | + buildah login -u campenbe -p ${{secrets.GIT_TOKEN}} gitea.ampenberger.com + buildah push gitea.ampenberger.com/campenbe/${PACKAGE_NAME}:${LABEL}