From 663fb67bf5b8f4bce22538b17ec47ea5e3121fb8 Mon Sep 17 00:00:00 2001 From: Artem K Date: Wed, 2 Jul 2025 21:16:20 +0200 Subject: [PATCH] pipeline configuration --- .gitlab-ci.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..84ccde0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,58 @@ +stages: + - build-and-deploy + +variables: + ZOLA_VERSION: "0.20.0" + TEMPLATES_REPO: "netangel/solombala-shipyard-archive-site" + SCRIPTS_REPO: "netangel/archive-tovarishestvo" + S3_ENDPOINT: "se-sto-1.linodeobjects.com" + S3_BUCKET: "schooner-archive-v2" + GIT_SUBMODULE_STRATEGY: none + +build-and-deploy: + stage: build-and-deploy + image: ubuntu:latest + rules: + - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_PIPELINE_SOURCE == "web" + before_script: + # Update package list and install dependencies + - apt-get update -qq + - apt-get install -y curl tar sudo git openssh-client s3cmd powershell + + script: + # Clone template repository from GitHub (public) + - git clone https://github.com/$TEMPLATES_REPO.git template + + # Clone scripts repository from GitHub (private) + - git clone https://$GITHUB_TOKEN@github.com/$SCRIPTS_REPO.git scripts + + # Install Zola + - curl -L "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar xz + - mv zola /usr/local/bin + + # Convert JSON to Zola content using PowerShell + - pwsh -Command ". ./scripts/Convert-ToZola.ps1 -MetadataPath ./ -ZolaContentPath ./template/content" + + # Build Zola site + - cd template + - zola build + - cd .. + + # Configure s3cmd + - | + cat > ~/.s3cfg << EOF + [default] + access_key = $LINODE_BUCKET_ACCESS_KEY_ID + secret_key = $LINODE_BUCKET_SECRET_ACCESS_KEY + host_base = $S3_ENDPOINT + host_bucket = %(bucket)s.$S3_ENDPOINT + use_https = True + EOF + + # Upload to Linode Objects + - | + s3cmd sync --acl-public \ + --no-mime-magic \ + --guess-mime-type \ + ./template/public/ s3://$S3_BUCKET/