From 33f7c16ee2bf9b91ed22a9fffb01820cf4edb63e Mon Sep 17 00:00:00 2001 From: gitea-admin Date: Sat, 18 Jul 2026 16:15:11 +0200 Subject: [PATCH] Add sampleapp content + Gitea Actions CI/CD workflow --- .gitea/workflows/ci.yaml | 62 ++++++++++++++++++++++++++++++++++++++++ Dockerfile | 3 ++ index.html | 40 ++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 .gitea/workflows/ci.yaml create mode 100644 Dockerfile create mode 100644 index.html diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..d4e678c --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,62 @@ +name: sampleapp-cicd + +on: + push: + branches: ["**"] + pull_request: + +jobs: + ci: + runs-on: ubuntu-latest + env: + REGISTRY: gitea.tests01.helity.org + IMAGE: gitea.tests01.helity.org/lab/sampleapp + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Lint / validate content + run: | + set -e + test -f index.html + test -f Dockerfile + grep -q "" index.html + grep -q "FROM nginx" Dockerfile + echo "lint OK" + + - name: Inject commit SHA into page + run: | + set -e + sed -i "s/__GIT_SHA__/${GITHUB_SHA}/g" index.html + grep -q "${GITHUB_SHA}" index.html && echo "sha injected: ${GITHUB_SHA}" + + - name: Build image + run: | + set -e + docker build -t "${IMAGE}:${GITHUB_SHA}" -t "${IMAGE}:latest" . + + - name: Push image (main only) + if: github.ref == 'refs/heads/main' + run: | + set -e + echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${REGISTRY}" -u "${{ secrets.REGISTRY_USER }}" --password-stdin + docker push "${IMAGE}:${GITHUB_SHA}" + docker push "${IMAGE}:latest" + docker logout "${REGISTRY}" + + deploy: + runs-on: ubuntu-latest + needs: ci + if: github.ref == 'refs/heads/main' + steps: + - name: Trigger Rundeck deploy job + run: | + set -e + code=$(curl -fsS -o /tmp/rd.json -w '%{http_code}' -X POST \ + -H "X-Rundeck-Auth-Token: ${{ secrets.RUNDECK_TOKEN }}" \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + "${{ secrets.RUNDECK_URL }}/api/40/job/${{ secrets.DEPLOY_JOB_UUID }}/run" \ + --data "{\"options\":{\"image_tag\":\"${GITHUB_SHA}\"}}") + echo "Rundeck run HTTP ${code}" + python3 -c "import json;d=json.load(open('/tmp/rd.json'));print('execution id:',d.get('id'),'status:',d.get('status'),'permalink:',d.get('permalink'))" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5ebe438 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:alpine +COPY index.html /usr/share/nginx/html/index.html +EXPOSE 80 diff --git a/index.html b/index.html new file mode 100644 index 0000000..9dfbf90 --- /dev/null +++ b/index.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>sampleapp — CI/CD deployed + + + +
+ sampleapp · live +

Deployed via the GitOps pipeline

+

+ This page is served by the container image built and pushed by + Gitea Actions, then deployed to rocky10 by a + Rundeck job that the CI workflow triggered over the Rundeck API. +

+

commit __GIT_SHA__

+

The pipeline that produced this page:

+ + +
+ +