fix(gitlab-ci): 💚 fix issue relating to container entrypoint stuff

Also in this commit, we improved the build script to
use the virtualenv setup we did to isolate dependencies from the rest
of the build system. We also did
some adjustments on caching deps to speed up the CI.

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@gmail.com>
This commit is contained in:
Andrei Jiroh Halili 2023-03-27 15:29:38 +00:00
parent 3b92600c23
commit eab9ae94a6
2 changed files with 32 additions and 17 deletions

View file

@ -1,19 +1,18 @@
image:
name: dock.mau.dev/ajhalili2006/tildeverse-web/build-ci
entrypoint:
- /bin/sh
- sh
.build-configs:
variables:
FF_ENABLE_COMMIT_DATA: "true"
FF_GENERATE_SOCIAL_CARDS: "true"
SECURE_FILES_DOWNLOAD_PATH: /run/secrets
variables:
FF_ENABLE_COMMIT_DATA: "true"
FF_GENERATE_SOCIAL_CARDS: "true"
SECURE_FILES_DOWNLOAD_PATH: /run/secrets
.setupkit:
before_script:
- apk add curl gnupg
- apk add curl gnupg bash coreutils
- curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | bash
- (curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh || wget -t 3 -qO- https://cli.doppler.com/install.sh) | sudo sh
- (curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh || wget -t 3 -qO- https://cli.doppler.com/install.sh) | sh
stages:
- build
@ -21,19 +20,20 @@ stages:
- deploy
build:main:
extends: [ .build-configs ]
extends: [ .setupkit ]
stage: build
script:
- mkdocs build
- bash ./build.sh
artifacts:
paths:
- public
untracked: false
when: on_success
expire_in: "30 days"
expire_in: "21 days"
cache:
paths:
- .cache
- .venv
key: pages-build-main
rules:
- if: $CI_COMMIT_BRANCH == 'main'
@ -44,10 +44,20 @@ build:main:
deploy:main:
stage: deploy
extends: [ .setupkit, .build-configs ]
extends: [ .setupkit ]
needs:
- build:main
script:
- apk add nodejs-lts npm
- apk add nodejs-lts npm && npm i
- ls -Al
- doppler run -- echo hi
- doppler run -- echo hi
cache:
paths:
- node_modules
key: deploykit-main
rules:
- if: $CI_COMMIT_BRANCH == 'main'
changes:
- mkdocs.yml
- markdown/*
- markdown/**/*

View file

@ -1,10 +1,15 @@
#!/usr/bin/env bash
set -xe
TARGET_DIR=${TARGET_DIR:-"$HOME/public_html"}
TARGET_DIR=${TARGET_DIR:-"$PWD/public"}
FF_OFFLINE_MKDOCS_PLUGIN=${FF_OFFLINE_MKDOCS_PLUGIN:-"false"}
FF_ENABLE_COMMIT_DATA=${FF_ENABLE_COMMIT_DATA:-"true"}
FF_GENERATE_SOCIAL_CARDS=${FF_GENERATE_SOCIAL_CARDS:-"true"}
pip3 install -r requirements.txt --user
mkdocs build -d $TARGET_DIR
if [[ ! -d "$PWD/.venv" ]]; then
python3 -m venv $PWD/.venv
fi
$PWD/.venv/bin/pip3 install -r requirements.txt --upgrade
$PWD/.venv/bin/mkdocs build -d $TARGET_DIR
set +xe