Verified Commit 77483c4c authored by Adrian Pascu's avatar Adrian Pascu
Browse files

Use Staging environment from Gitlab Pages

parent 466a58fa
Loading
Loading
Loading
Loading
Loading
+16 −4
Changes for .gitlab-ci.yml: 16 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -18,15 +18,27 @@ Build:
    - curl --fail https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/repository/commits?private_token=$GITLAB_API_KEY > 'data/changelog/changelog.json'
    - hugo version
    - hugo
  artifacts:
    expire_in: 1 week
    paths:
      - public

pages:
  stage: Deploy
  image: debian:trixie
  needs: ["Build"]
  environment:
    name: Staging
    url: "https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/index.html"
    url: $CI_PAGES_URL
  rules:
    - if: '$CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_BRANCH != "$CI_DEFAULT_BRANCH"'
  script:
    - echo "Deploying to Gitlab Pages"
  artifacts:
    expire_in: 1 week
    paths:
      - public

Deploy:
Deploy Production:
  stage: Deploy
  image: debian:trixie
  needs: ["Build"]
@@ -34,7 +46,7 @@ Deploy:
    name: Production
    url: https://hsbxl.be
  rules:
    - if: '$CI_COMMIT_BRANCH == "main" && $PRIVKEY'
    - if: '$CI_COMMIT_BRANCH == "$CI_DEFAULT_BRANCH" && $PRIVKEY'
  script:
    - apt-get update
    - apt-get install openssh-client tree -y