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-<short>` 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) <noreply@anthropic.com>
This commit is contained in:
@@ -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 }}
|
||||||
Vendored
-54
@@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
services:
|
||||||
|
dayDrain:
|
||||||
|
image: gitea.thewrightserver.net/josh/workweekprogress:latest
|
||||||
|
container_name: day-drain
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
Reference in New Issue
Block a user