Compare commits

..

24 Commits

Author SHA1 Message Date
b2747f1959 Merge pull request 'fix-create-site-workflow' (#2) from fix-create-site-workflow into main
All checks were successful
Build and Deploy Site / build-and-deploy (push) Successful in 2m13s
Build Container Image / build-container (push) Successful in 16s
Reviewed-on: #2
2026-01-19 22:00:14 +03:00
Krivopolenov, Artemiy
246e9c2667 S3 upload issue fixed 2026-01-19 19:56:16 +01:00
Krivopolenov, Artemiy
bf2c93a084 s3 upload improvements 2026-01-19 19:39:23 +01:00
Krivopolenov, Artemiy
e6d69f59e8 sha as tag 2026-01-19 19:21:25 +01:00
Krivopolenov, Artemiy
038c42dff7 removed incorrect flag 2026-01-19 19:01:21 +01:00
Krivopolenov, Artemiy
61f65d6df0 container deploy fixed and debug info added 2026-01-19 18:56:52 +01:00
Krivopolenov, Artemiy
f5fd35d12e Docker update to include nodejs 2026-01-19 18:49:58 +01:00
Krivopolenov, Artemiy
e8bb42c1b6 host name and image name fixed 2026-01-19 18:45:57 +01:00
0d10f383ec Merge pull request 'Docker workflow fixed' (#1) from workflow-debugging into main
Reviewed-on: #1
2026-01-19 10:27:05 +03:00
Krivopolenov, Artemiy
cad40e3c44 registry-based caching try 2026-01-19 08:18:52 +01:00
Krivopolenov, Artemiy
11844e9945 caching disabling 2026-01-18 20:42:37 +01:00
Krivopolenov, Artemiy
06355772ed simplified registry host name 2026-01-18 20:19:37 +01:00
Krivopolenov, Artemiy
3837466a7a cleaner registry name and url one more time with debug 2026-01-18 20:14:05 +01:00
Krivopolenov, Artemiy
a9179191b9 cleaner registry name and url 2026-01-18 20:11:49 +01:00
Krivopolenov, Artemiy
1c2261ec99 fixing registry url 2026-01-18 20:08:18 +01:00
Krivopolenov, Artemiy
6873df57c7 fixing registry name env 2026-01-18 20:05:15 +01:00
Krivopolenov, Artemiy
9a9323e0aa fixing secret name 2026-01-18 19:59:43 +01:00
Krivopolenov, Artemiy
36093517fb removing all debug things 2026-01-18 19:40:51 +01:00
Krivopolenov, Artemiy
d2059c39f5 more manual debugging 2026-01-18 19:33:43 +01:00
Krivopolenov, Artemiy
03bcf313ca env var debug 2026-01-18 19:29:38 +01:00
Krivopolenov, Artemiy
8e82f3b6a2 more debug info 2026-01-18 19:26:19 +01:00
Krivopolenov, Artemiy
6da9ef7b9b more debugging for workflow 2026-01-18 19:17:32 +01:00
Krivopolenov, Artemiy
9b231718e3 debugging gitea actions runner 2026-01-18 19:11:51 +01:00
Krivopolenov, Artemiy
0521527fbe Gitea workflow configuration and Dockerfile
Some checks failed
Build and Deploy Site / build-and-deploy (push) Failing after 0s
Build Container Image / build-container (push) Failing after 43s
2026-01-18 10:45:08 +01:00
3 changed files with 204 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
# Gitea Actions workflow for building and deploying Zola site from metadata
# This workflow runs in the metadata repository when changes are merged to main
#
# Place this file in the metadata repository:
# .gitea/workflows/build-and-deploy.yaml
#
# Required secrets:
# - CONTAINER_TOKEN: Token with read:package permission (for pulling container image)
# - AWS_ACCESS_KEY_ID: S3 access key
# - AWS_SECRET_ACCESS_KEY: S3 secret key
#
# Required variables (set in repo settings):
# - TEMPLATES_REPO_URL: URL to templates repository (https)
# - SCRIPTS_REPO_URL: URL to scripts repository (https)
# - S3_ENDPOINT: S3 endpoint URL (e.g., garage.example.com)
# - S3_BUCKET: Target S3 bucket name
name: Build and Deploy Site
on:
push:
branches:
- main
paths-ignore:
- "Dockerfile"
- ".gitea/workflows/build-container.yaml"
workflow_dispatch:
env:
REGISTRY_HOST: git.dwal.in
IMAGE_NAME: zola-pwsh-s3
TEMPLATES_REPO_URL: ${{ vars.TEMPLATES_REPO_URL }}
SCRIPTS_REPO_URL: ${{ vars.SCRIPTS_REPO_URL }}
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
S3_BUCKET: ${{ vars.S3_BUCKET }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# Use custom container with PowerShell, Zola, AWS CLI, Git pre-installed
# Built by build-container.yaml workflow from integrations/gitea/Dockerfile
container:
image: ${{ env.REGISTRY_HOST }}/${{ gitea.repository }}/${{ env.IMAGE_NAME }}:latest
credentials:
username: ${{ gitea.actor }}
password: ${{ secrets.CONTAINER_TOKEN }}
steps:
- name: Checkout metadata repository
uses: actions/checkout@v4
with:
path: metadata
- name: Clone templates repository
run: |
echo "Cloning templates from $TEMPLATES_REPO_URL"
git clone "$TEMPLATES_REPO_URL" template
- name: Clone scripts repository
run: |
echo "Cloning scripts from $SCRIPTS_REPO_URL"
git clone "$SCRIPTS_REPO_URL" scripts
- name: Convert metadata to Zola content
run: |
echo "Running PowerShell conversion script"
pwsh -File "./scripts/ConvertTo-ZolaContent.ps1" \
-MetadataPath "./metadata" \
-ZolaContentPath "./template/content"
- name: Build Zola site
run: |
cd template
zola build
echo "Site built successfully"
ls -la public/
- name: Configure AWS CLI for S3
run: |
mkdir -p ~/.aws
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key = ${{ secrets.AWS_SECRET_ACCESS_KEY }}
EOF
cat > ~/.aws/config << EOF
[default]
region = garage
output = json
s3 =
max_concurrent_requests = 20
max_queue_size = 10000
EOF
- name: Upload to S3 (Garage)
run: |
echo "Uploading to s3://$S3_BUCKET with parallel transfers"
aws s3 sync ./template/public/ "s3://$S3_BUCKET/" \
--endpoint-url "https://$S3_ENDPOINT" \
--acl public-read \
--exclude "media/*" \
--delete \
--quiet
echo "Upload complete"

View File

@@ -0,0 +1,65 @@
# Gitea Actions workflow for building the Zola build container
# This workflow builds and pushes the container image to Gitea's container registry
#
# Place this file and Dockerfile in the metadata repository:
# .gitea/workflows/build-container.yaml
# Dockerfile (in repo root)
#
# Triggers:
# - When Dockerfile changes
# - Manual dispatch
#
# The built image will be available at:
# <gitea-url>/<owner>/<repo>/zola-pwsh-s3:latest
name: Build Container Image
on:
push:
branches:
- main
paths:
- "Dockerfile"
workflow_dispatch:
env:
IMAGE_NAME: zola-pwsh-s3
REGISTRY_HOST: git.dwal.in
jobs:
build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_HOST }}
username: ${{ gitea.actor }}
password: ${{ secrets.CONTAINER_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_HOST }}/${{ gitea.repository }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=sha,prefix=
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY_HOST }}/${{ gitea.repository }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY_HOST }}/${{ gitea.repository }}/${{ env.IMAGE_NAME }}:buildcache,mode=max

35
Dockerfile Normal file
View File

@@ -0,0 +1,35 @@
# Minimalistic container for Zola site building from metadata
# Contains: PowerShell, Zola, AWS CLI (S3), Git
FROM alpine:3.20 AS builder
ARG ZOLA_VERSION=0.22.0
# Download and extract Zola
RUN apk add --no-cache curl tar \
&& curl -L "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /usr/local/bin
# Final image based on PowerShell Alpine
FROM mcr.microsoft.com/powershell:lts-alpine-3.20
# Copy Zola from builder
COPY --from=builder /usr/local/bin/zola /usr/local/bin/zola
# Install minimal dependencies: git, aws-cli (for S3), ca-certificates, nodejs (for GitHub Actions)
RUN apk add --no-cache \
git \
aws-cli \
ca-certificates \
nodejs \
&& rm -rf /var/cache/apk/*
# Verify installations
RUN pwsh -Version \
&& zola --version \
&& aws --version \
&& git --version \
&& node --version
WORKDIR /workspace
ENTRYPOINT ["/bin/sh", "-c"]