From 6fa9b6f8b60339f9030788f2d60310c5fa313ebc Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 24 Apr 2026 10:20:31 -0400 Subject: [PATCH] Migrate CI from Jenkins to Gitea Actions Replaces the Jenkinsfile with a .gitea/workflows/build-push.yml that builds on pushes to main and pushes `latest` + `sha-` tags to the Gitea package registry using the REGISTRY_URL variable and REGISTRY_TOKEN secret. Adds a docker-compose.yml that pulls the published image for deployment. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/build-push.yml | 38 +++++++++++++++++++++++ Jenkinsfile | 54 --------------------------------- docker-compose.yml | 7 +++++ 3 files changed, 45 insertions(+), 54 deletions(-) create mode 100644 .gitea/workflows/build-push.yml delete mode 100644 Jenkinsfile create mode 100644 docker-compose.yml diff --git a/.gitea/workflows/build-push.yml b/.gitea/workflows/build-push.yml new file mode 100644 index 0000000..0f56d0d --- /dev/null +++ b/.gitea/workflows/build-push.yml @@ -0,0 +1,38 @@ +name: Build and Push Image + +on: + push: + branches: [main] + +env: + IMAGE: josh/workweekprogress + +jobs: + build-push: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Compute short SHA + id: vars + run: echo "sha_short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Gitea registry + uses: docker/login-action@v3 + with: + registry: ${{ vars.REGISTRY_URL }} + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ vars.REGISTRY_URL }}/${{ env.IMAGE }}:latest + ${{ vars.REGISTRY_URL }}/${{ env.IMAGE }}:sha-${{ steps.vars.outputs.sha_short }} diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index ba5f7da..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,54 +0,0 @@ -pipeline { - agent any - - environment { - REGISTRY = "gitea.thewrightserver.net" - IMAGE = "gitea.thewrightserver.net/josh/workweekprogress" - TAG = "${env.BUILD_NUMBER}" - } - - stages { - stage("Checkout") { - steps { - checkout scm - } - } - - stage("Build Image") { - steps { - sh """ - docker build \ - -t ${IMAGE}:${TAG} \ - -t ${IMAGE}:latest \ - . - """ - } - } - - stage("Push Image") { - steps { - withCredentials([ - usernamePassword( - credentialsId: 'gitea-registry-creds', - usernameVariable: 'GITEA_USER', - passwordVariable: 'GITEA_TOKEN' - ) - ]) { - sh """ - echo "$GITEA_TOKEN" | docker login ${REGISTRY} \ - -u "$GITEA_USER" --password-stdin - - docker push ${IMAGE}:${TAG} - docker push ${IMAGE}:latest - """ - } - } - } - } - - post { - cleanup { - sh "docker image prune -f" - } - } -} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e35e01c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + dayDrain: + image: gitea.thewrightserver.net/josh/workweekprogress:latest + container_name: day-drain + restart: unless-stopped + ports: + - "5000:5000"