From 2c053d40ddca4123954a11e378b5f1a3afcea560 Mon Sep 17 00:00:00 2001 From: James Brechtel Date: Thu, 4 Jun 2026 15:27:37 -0400 Subject: [PATCH] feat: add Gitea Actions workflow for building and publishing OCI images --- .gitea/workflows/build.yaml | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..0bb3810 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,77 @@ +name: Build and Publish OCI Images + +on: + push: + tags: + - 'v*' + +env: + REGISTRY: git.roo.lol + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_TOKEN }} + IMAGE_NAMESPACE: ${{ github.repository_owner }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Extract Roc version from tag + id: version + run: | + # Strip leading 'v' from tag name: v0.0.0-alpha2 -> 0.0.0-alpha2 + ROC_VERSION="${GITHUB_REF_NAME#v}" + echo "roc_version=${ROC_VERSION}" >> "$GITHUB_OUTPUT" + echo "ROC_VERSION=${ROC_VERSION}" >> "$GITHUB_ENV" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to registry + run: | + echo "$REGISTRY_PASSWORD" | docker login $REGISTRY -u $REGISTRY_USER --password-stdin + + - name: Build and push base image + uses: docker/build-push-action@v6 + with: + context: . + target: base + build-args: ROC_VERSION=${{ steps.version.outputs.roc_version }} + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/roc-tools-base:${{ steps.version.outputs.roc_version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/roc-tools-base:latest + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push dev image + uses: docker/build-push-action@v6 + with: + context: . + target: dev + build-args: ROC_VERSION=${{ steps.version.outputs.roc_version }} + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/roc-tools-dev:${{ steps.version.outputs.roc_version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/roc-tools-dev:latest + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Build and push ci image + uses: docker/build-push-action@v6 + with: + context: . + target: ci + build-args: ROC_VERSION=${{ steps.version.outputs.roc_version }} + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/roc-tools-ci:${{ steps.version.outputs.roc_version }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/roc-tools-ci:latest + push: true + cache-from: type=gha + cache-to: type=gha,mode=max