Loading .gitlab-ci.yml +11 −15 Original line number Diff line number Diff line Loading @@ -13,24 +13,9 @@ include: - local: pipelines/project-automation.yml - local: yaml/yamllint.yml - local: project-automation/pipeline-scheduler.yml - local: project-automation/pages-hugo.yml - local: project-automation/gitlab/py-in-ci.yml - local: docs/prettier.yml .pages: variables: HUGO_BASEURL: ${CI_PAGES_URL} HUGO_DEFAULT_ARGS: "" # minify causes problems with our README before_script: - cd tests/mockup_projects/pages - git clone https://github.com/alexandrevicenzi/soho.git themes/soho - mkdir content - cp ${CI_PROJECT_DIR}/README.md content/_index.md needs: [] pages: stage: test # child pipeline to unit tests all our jobs jobs:c: Loading Loading @@ -123,6 +108,17 @@ jobs:python:custom-image: changes: - python/**/* jobs:pages: stage: test trigger: include: - local: tests/jobs/web.yml strategy: depend rules: - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH changes: - web/**/* # child pipelines to test our off-the-shelf pipelines pipelines:c: stage: test Loading pipelines/pages.yml +1 −1 Original line number Diff line number Diff line --- include: - local: project-automation/badge.yml - local: project-automation/pages-hugo.yml - local: project-automation/pages.yml badge:pages: extends: .badge Loading tests/jobs/web.yml 0 → 100644 +13 −0 Original line number Diff line number Diff line --- include: - local: web/pages.yml .hugo: variables: HUGO_BASEURL: ${CI_PAGES_URL} HUGO_DEFAULT_ARGS: "" # minify causes problems with our README before_script: - cd tests/mockup_projects/pages - git clone https://github.com/alexandrevicenzi/soho.git themes/soho - mkdir content - cp ${CI_PROJECT_DIR}/README.md content/_index.md project-automation/pages-hugo.yml→web/hugo.yml +5 −22 Original line number Diff line number Diff line Loading @@ -11,39 +11,22 @@ include: - local: project-automation/telemetry.yml variables: HUGO_DEFAULT_ARGS: --minify HUGO_EXTRA_ARGS: "" HUGO_DEFAULT_ARGS: --gc --minify .pages: .hugo: extends: .telemetry stage: deploy image: name: registry.gitlab.com/just-ci/images/hugo:latest entrypoint: [""] script: - hugo version - | echo "Running Hugo with args: ${HUGO_DEFAULT_ARGS} ${HUGO_EXTRA_ARGS}" - hugo --destination ${CI_PROJECT_DIR}/public ${HUGO_DEFAULT_ARGS} ${HUGO_EXTRA_ARGS} - gzip -kr ${CI_PROJECT_DIR}/public - | if [ "${CI_COMMIT_BRANCH}" != "${CI_DEFAULT_BRANCH}" ]; then echo "[!] When browing the test job artifacts you may not see the full final result when opening an HTML file, as the built site may reference absolute URLs." fi artifacts: paths: - public when: always pages: extends: .pages stage: build rules: - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH pages:dev: extends: .pages stage: test environment: name: Development url: $CI_SERVER_URL/-/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/file/public/index.html rules: - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH web/netlify.yml 0 → 100644 +45 −0 Original line number Diff line number Diff line --- # Builds a site using hugo, to then deploy to Netlify # Requires setting SITE_DOMAIN variable include: - local: web/hugo.yml .netlify: extends: .hugo variables: HUGO_BASEURL: https://${SITE_DOMAIN} script: - !reference [.hugo, script] - | echo "netlify args: ${NETLIFY_DEFAULT_ARGS} ${NETLIFY_EXTRA_ARGS}" - netlify deploy ${NETLIFY_DEFAULT_ARGS} ${NETLIFY_EXTRA_ARGS} --site ${NETLIFY_SITE_ID} --auth ${NETLIFY_AUTH_TOKEN} netlify: extends: .netlify variables: NETLIFY_DEFAULT_ARGS: --prod environment: name: production url: ${SITE_DOMAIN} rules: - if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $NETLIFY_AUTH_TOKEN && $NETLIFY_SITE_ID && $SITE_DOMAIN" netlify:branch: extends: .netlify variables: ALIAS: ${CI_COMMIT_REF_SLUG} SITE_DOMAIN: ${ALIAS}--${NETLIFY_SITE_ID}.netlify.app ENVIRONMENT: staging HUGO_EXTRA_ARGS: --environment ${ENVIRONMENT} NETLIFY_DEFAULT_ARGS: --alias "${ALIAS}" environment: name: ${ENVIRONMENT} url: ${SITE_DOMAIN} rules: - if: "$CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH && $NETLIFY_AUTH_TOKEN && $NETLIFY_SITE_ID && $SITE_DOMAIN" Loading
.gitlab-ci.yml +11 −15 Original line number Diff line number Diff line Loading @@ -13,24 +13,9 @@ include: - local: pipelines/project-automation.yml - local: yaml/yamllint.yml - local: project-automation/pipeline-scheduler.yml - local: project-automation/pages-hugo.yml - local: project-automation/gitlab/py-in-ci.yml - local: docs/prettier.yml .pages: variables: HUGO_BASEURL: ${CI_PAGES_URL} HUGO_DEFAULT_ARGS: "" # minify causes problems with our README before_script: - cd tests/mockup_projects/pages - git clone https://github.com/alexandrevicenzi/soho.git themes/soho - mkdir content - cp ${CI_PROJECT_DIR}/README.md content/_index.md needs: [] pages: stage: test # child pipeline to unit tests all our jobs jobs:c: Loading Loading @@ -123,6 +108,17 @@ jobs:python:custom-image: changes: - python/**/* jobs:pages: stage: test trigger: include: - local: tests/jobs/web.yml strategy: depend rules: - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH changes: - web/**/* # child pipelines to test our off-the-shelf pipelines pipelines:c: stage: test Loading
pipelines/pages.yml +1 −1 Original line number Diff line number Diff line --- include: - local: project-automation/badge.yml - local: project-automation/pages-hugo.yml - local: project-automation/pages.yml badge:pages: extends: .badge Loading
tests/jobs/web.yml 0 → 100644 +13 −0 Original line number Diff line number Diff line --- include: - local: web/pages.yml .hugo: variables: HUGO_BASEURL: ${CI_PAGES_URL} HUGO_DEFAULT_ARGS: "" # minify causes problems with our README before_script: - cd tests/mockup_projects/pages - git clone https://github.com/alexandrevicenzi/soho.git themes/soho - mkdir content - cp ${CI_PROJECT_DIR}/README.md content/_index.md
project-automation/pages-hugo.yml→web/hugo.yml +5 −22 Original line number Diff line number Diff line Loading @@ -11,39 +11,22 @@ include: - local: project-automation/telemetry.yml variables: HUGO_DEFAULT_ARGS: --minify HUGO_EXTRA_ARGS: "" HUGO_DEFAULT_ARGS: --gc --minify .pages: .hugo: extends: .telemetry stage: deploy image: name: registry.gitlab.com/just-ci/images/hugo:latest entrypoint: [""] script: - hugo version - | echo "Running Hugo with args: ${HUGO_DEFAULT_ARGS} ${HUGO_EXTRA_ARGS}" - hugo --destination ${CI_PROJECT_DIR}/public ${HUGO_DEFAULT_ARGS} ${HUGO_EXTRA_ARGS} - gzip -kr ${CI_PROJECT_DIR}/public - | if [ "${CI_COMMIT_BRANCH}" != "${CI_DEFAULT_BRANCH}" ]; then echo "[!] When browing the test job artifacts you may not see the full final result when opening an HTML file, as the built site may reference absolute URLs." fi artifacts: paths: - public when: always pages: extends: .pages stage: build rules: - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH pages:dev: extends: .pages stage: test environment: name: Development url: $CI_SERVER_URL/-/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/file/public/index.html rules: - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
web/netlify.yml 0 → 100644 +45 −0 Original line number Diff line number Diff line --- # Builds a site using hugo, to then deploy to Netlify # Requires setting SITE_DOMAIN variable include: - local: web/hugo.yml .netlify: extends: .hugo variables: HUGO_BASEURL: https://${SITE_DOMAIN} script: - !reference [.hugo, script] - | echo "netlify args: ${NETLIFY_DEFAULT_ARGS} ${NETLIFY_EXTRA_ARGS}" - netlify deploy ${NETLIFY_DEFAULT_ARGS} ${NETLIFY_EXTRA_ARGS} --site ${NETLIFY_SITE_ID} --auth ${NETLIFY_AUTH_TOKEN} netlify: extends: .netlify variables: NETLIFY_DEFAULT_ARGS: --prod environment: name: production url: ${SITE_DOMAIN} rules: - if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $NETLIFY_AUTH_TOKEN && $NETLIFY_SITE_ID && $SITE_DOMAIN" netlify:branch: extends: .netlify variables: ALIAS: ${CI_COMMIT_REF_SLUG} SITE_DOMAIN: ${ALIAS}--${NETLIFY_SITE_ID}.netlify.app ENVIRONMENT: staging HUGO_EXTRA_ARGS: --environment ${ENVIRONMENT} NETLIFY_DEFAULT_ARGS: --alias "${ALIAS}" environment: name: ${ENVIRONMENT} url: ${SITE_DOMAIN} rules: - if: "$CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH && $NETLIFY_AUTH_TOKEN && $NETLIFY_SITE_ID && $SITE_DOMAIN"