Search code examples
gitlabyamlweb-deploymentgitlab-cipipeline

Confusing relative paths in deploying the site. I want to deploy site without the folder "public" in GitLab?


I tried to solve with the following questions:

But no luck.

I built a GitLab's YAML file. It is very confused with the absolute or relative paths and does not detect the files and the images from the folder assets.

Here is:

pages:
  stage: deploy
  script:
    - echo "Olá Felipe e Daniel! :-)"
  artifacts:
    paths:
    - public
  only:
  - gusbemacbe

I want to change public to ., I am not sure if it will work. If it can not, I will maintain, but I want to fix the YAML file.

Here is the repository tree:

repository
├── public
│   ├── 404.html
│   ├── assets
│   │   ├── css
│   │   ├── fonts
│   │   ├── images
│   │   └── js
│   ├── index.html
│   └── nbproject
│       ├── private
│       │   ├── private.properties
│       │   └── private.xml
│       ├── project.properties
│       └── project.xml

Here is small CSS snippet:

.about 
{
    background-image: url('/assets/images/[email protected]');
    background-size: cover;
    background-position: center;
    text-align: center;
    padding: 25px 0px 20px 0px;
}

And small HTML snippet:

<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <link rel="icon" href="./assets/images/favicons/favicon.ico" />
        <link rel="stylesheet" media='all' type="text/css" href="./assets/css/font-awesome.css">
        <link rel="stylesheet" media='all' type="text/css" href="./assets/css/style.css">
        <link rel="stylesheet" media='all' type="text/css" href="./assets/css/media-queries.css">
    <body>
       <a class="navbar-brand" href="index.html">
          <img src="./assets/images/logotipo.svg" width="30" height="30" alt="">
       </a>

        <script src="./assets/js/jquery.js"></script>
        <script src="./assets/js/popper.js"></script>
        <script src="./assets/js/bootstrap.bundle.js"></script>

        <script src="./assets/js/firebase/firebase-app.js"></script>
        <script src="./assets/js/firebase/firebase-analytics.js"></script>

        <script src="./assets/js/firebase/firebase-firestore.js"></script>
        <script src="./assets/js/firebase/firebase-storage.js"></script>

    </body>
</html>

Solution

  • You need to copy the assets into the public directory. For example:

    pages:
      stage: deploy
      script:
      - mkdir public
      - cp assets/* public/
      artifacts:
        paths:
        - public
      only:
      - gusbemacbe