Minimal .gitlab-ci.yml file for a plain HTML website

231 Views Asked by At

Website content

.
├── index.html
└── images/
    ├── a.jpg
    ├── b.jpg
    └── c.jpg

I wonder if the following is still valid and reliable. I found it on a blog post written in 2016.

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - main

Is the current CI template any better?

pages:
  stage: deploy
  environment: production
  script:
    - mkdir .public
    - cp -r ./* .public
    - rm -rf public
    - mv .public public
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
1

There are 1 best solutions below

0
KD_Raj On

This worked quite easily for me in (2023)

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master