From f761290ed7de7e33b009c8607f4ede663ba15d1c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 3 Mar 2026 16:53:48 -0600 Subject: [PATCH] chore(config): add Renovate and build workflows --- .forgejo/workflows/build.yaml | 62 +++++++++++++++++++++++++++++++ .forgejo/workflows/renovate.yaml | 27 ++++++++++++++ renovate.json | 64 ++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 .forgejo/workflows/build.yaml create mode 100644 .forgejo/workflows/renovate.yaml create mode 100644 renovate.json diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 00000000..7a948dd5 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,62 @@ +name: Build + +on: + push: + branches: + - main + +env: + DOCKER_BUILDKIT: 1 + DOCKER_TLS_CERTDIR: "" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to container registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.REGISTRY_URL }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Extract metadata + id: meta + run: | + TIMESTAMP=$(date +%s) + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) + IMAGE=${{ secrets.REGISTRY_URL }}/${{ github.repository }} + echo "image=${IMAGE}" >> $GITHUB_OUTPUT + echo "tag=${IMAGE}:main-${TIMESTAMP}-${SHORT_SHA}" >> $GITHUB_OUTPUT + echo "latest_tag=${IMAGE}:latest" >> $GITHUB_OUTPUT + echo "cache_tag=${IMAGE}:buildcache" >> $GITHUB_OUTPUT + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ${{ steps.meta.outputs.tag }} + ${{ steps.meta.outputs.latest_tag }} + cache-from: type=registry,ref=${{ steps.meta.outputs.cache_tag }} + cache-to: type=registry,ref=${{ steps.meta.outputs.cache_tag }},mode=max + + - name: Update deployment image tag + run: | + sed -i "s|image: git\.mcintire\.me/graham/towerops-web:.*|image: ${{ steps.meta.outputs.tag }}|g" k8s/deployment.yaml + git config user.email "ci@git.mcintire.me" + git config user.name "CI" + git add k8s/deployment.yaml + git diff --cached --quiet || git commit -m "chore: update towerops-web image to ${{ steps.meta.outputs.tag }} [skip ci]" + git push origin HEAD:main diff --git a/.forgejo/workflows/renovate.yaml b/.forgejo/workflows/renovate.yaml new file mode 100644 index 00000000..059dceb0 --- /dev/null +++ b/.forgejo/workflows/renovate.yaml @@ -0,0 +1,27 @@ +name: Renovate + +on: + schedule: + # Run daily at 6:00 AM UTC + - cron: '0 6 * * *' + workflow_dispatch: + +jobs: + renovate: + runs-on: ubuntu-latest + container: + image: renovate/renovate:latest + steps: + - name: Checkout code + uses: https://github.com/actions/checkout@v4 + + - name: Run Renovate + env: + RENOVATE_PLATFORM: forgejo + RENOVATE_ENDPOINT: ${{ secrets.FORGEJO_ENDPOINT }} + RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }} + RENOVATE_GIT_AUTHOR: Renovate Bot + RENOVATE_AUTODISCOVER: false + LOG_LEVEL: info + run: | + renovate graham/towerops-web diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..efb9d9c0 --- /dev/null +++ b/renovate.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "gitAuthor": "Renovate Bot ", + "branchPrefix": "renovate/", + "semanticCommits": "enabled", + "dependencyDashboard": true, + "labels": [ + "dependencies" + ], + "schedule": [ + "at any time" + ], + "timezone": "UTC", + "prConcurrentLimit": 10, + "prCreation": "immediate", + "automerge": false, + "rangeStrategy": "bump", + "separateMajorMinor": true, + "separateMinorPatch": false, + "packageRules": [ + { + "description": "Elixir dependencies", + "matchManagers": [ + "mix" + ], + "matchUpdateTypes": [ + "major", + "minor", + "patch" + ], + "groupName": null, + "commitMessagePrefix": "chore(deps):" + }, + { + "description": "Docker dependencies", + "matchManagers": [ + "dockerfile" + ], + "matchUpdateTypes": [ + "major", + "minor", + "patch" + ], + "groupName": null, + "commitMessagePrefix": "chore(deps):" + }, + { + "description": "GitHub Actions", + "matchManagers": [ + "github-actions" + ], + "matchUpdateTypes": [ + "major", + "minor", + "patch" + ], + "groupName": null, + "commitMessagePrefix": "chore(deps):" + } + ] +}