added gitlab-ci

This commit is contained in:
somrat sorkar 2023-06-22 10:33:10 +06:00
parent 4a84754dc7
commit e22d13565a
3 changed files with 55 additions and 8 deletions

View File

@ -0,0 +1,47 @@
stages:
- build
variables:
HUGO_ENV: production
HUGO_VERSION: "0.114.0"
GO_VERSION: "1.16.3"
NODE_VERSION: "18.15.0"
cache:
paths:
- node_modules/
default:
image: node:${NODE_VERSION}
before_script:
- echo "USING NODE ${NODE_VERSION}"
- apt-get update && apt-get install -y curl
- curl -LO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz"
- tar -xvf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
- mv hugo /usr/local/bin/
- rm hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz
- echo "HUGO ${HUGO_VERSION} INSTALLED"
- curl -LO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz"
- tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- rm go${GO_VERSION}.linux-amd64.tar.gz
- echo "GO ${GO_VERSION} INSTALLED"
- npm install
test:
stage: build
script:
- npm run build
rules:
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
pages:
stage: build
script:
- npm run build
- echo "SITE BUILT SUCCESSFULLY! LIVE AT https://$GITLAB_USER_LOGIN.gitlab.io/$CI_PROJECT_NAME/"
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH

View File

@ -1,13 +1,13 @@
{ {
"name": "hugoplate", "name": "hugoplate",
"description": "hugo tailwindcss boilerplate", "description": "hugo tailwindcss boilerplate",
"version": "1.0.0", "version": "1.1.1",
"license": "MIT", "license": "MIT",
"author": "zeon.studio", "author": "zeon.studio",
"scripts": { "scripts": {
"dev": "cd exampleSite; hugo server 2> /dev/null || hugo server --themesDir ../..", "dev": "cd exampleSite; hugo server || hugo server --themesDir ../..",
"test": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify 2> /dev/null || hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify", "test": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify || hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify",
"build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --forceSyncStatic 2> /dev/null || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --forceSyncStatic", "build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
"update-modules": "hugo mod clean && hugo mod get -u ./... && hugo mod tidy", "update-modules": "hugo mod clean && hugo mod get -u ./... && hugo mod tidy",
"format": "prettier -w .", "format": "prettier -w .",
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format" "remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format"
@ -17,7 +17,7 @@
"@tailwindcss/forms": "^0.5.3", "@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"postcss": "^8.4.23", "postcss": "^8.4.24",
"postcss-cli": "^10.1.0", "postcss-cli": "^10.1.0",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"prettier-plugin-go-template": "0.0.13", "prettier-plugin-go-template": "0.0.13",

View File

@ -5,9 +5,9 @@
"license": "MIT", "license": "MIT",
"author": "zeon.studio", "author": "zeon.studio",
"scripts": { "scripts": {
"dev": "cd exampleSite; hugo server 2> /dev/null || hugo server --themesDir ../..", "dev": "cd exampleSite; hugo server || hugo server --themesDir ../..",
"test": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify 2> /dev/null || hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify", "test": "cd exampleSite; hugo server --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify || hugo server --themesDir ../.. --disableFastRender --navigateToChanged --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --watch --forceSyncStatic -e production --minify",
"build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --forceSyncStatic 2> /dev/null || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --verbose --verboseLog --buildDrafts --buildExpired --buildFuture --forceSyncStatic", "build": "cd exampleSite; hugo --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic || hugo --themesDir ../.. --gc --minify --templateMetrics --templateMetricsHints --buildDrafts --buildExpired --buildFuture --forceSyncStatic",
"update-modules": "hugo mod clean && hugo mod get -u ./... && hugo mod tidy", "update-modules": "hugo mod clean && hugo mod get -u ./... && hugo mod tidy",
"format": "prettier -w .", "format": "prettier -w .",
"remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format" "remove-darkmode": "node ./scripts/removeDarkmode.js && yarn format"