From fe617d8734ef94506610f3c5d0c5c442d7d74987 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 6 Jun 2021 16:26:35 +0100 Subject: [PATCH] Add GitLab CI config --- .gitlab-ci.yml | 65 +++++++++++++++++++++++++++++++++++++++++++ scripts/build.sh | 2 +- scripts/link-check.sh | 2 +- scripts/release.sh | 2 +- scripts/server.sh | 2 +- scripts/test.sh | 2 +- 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..84cd4a3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,65 @@ +stages: + - install + - build + - test + - deploy + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +install: + image: node:alpine + stage: install + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - .npm + - .cache + script: + - npm ci --cache .npm --prefer-offline + artifacts: + name: '$CI_JOB_ID-node_modules' + paths: + - ./node_modules + expire_in: 30 mins + +build: + image: node:alpine + stage: build + before_script: + - apk add --no-cache hugo + script: + - ./scripts/release.sh + artifacts: + name: '$CI_JOB_ID-public' + paths: + - ./public + expire_in: 30 mins + +test: + image: node:alpine + stage: test + dependencies: + - install + script: + - ./scripts/test.sh + +deploy: + image: alpine + stage: deploy + dependencies: + - build + only: + - master + environment: + name: website + url: https://theorangeone.net + before_script: + - apk add --no-cache rclone + script: + - export RCLONE_CONFIG_PAGES_PASS=`rclone obscure $RCLONE_WEBDAV_PASSWORD` + - rclone sync -v public/ pages:theorangeone.net/ + variables: + RCLONE_CONFIG_PAGES_TYPE: webdav + RCLONE_CONFIG_PAGES_URL: https://pages.theorangeone.net + RCLONE_CONFIG_PAGES_USER: github diff --git a/scripts/build.sh b/scripts/build.sh index 4c74168..efa8603 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -e diff --git a/scripts/link-check.sh b/scripts/link-check.sh index fb1ebfe..6eaf12e 100755 --- a/scripts/link-check.sh +++ b/scripts/link-check.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -e diff --git a/scripts/release.sh b/scripts/release.sh index f56308d..5f846ba 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -e diff --git a/scripts/server.sh b/scripts/server.sh index 403b43e..cc1377c 100755 --- a/scripts/server.sh +++ b/scripts/server.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -e diff --git a/scripts/test.sh b/scripts/test.sh index 678e2a6..96b3650 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -e