Hello!
I built a YAML file. GitLab 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 deploy a site without the folder public and change public to ., I am not sure if it will work. Here is the 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/quem-somos@1.jpg');
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>
If you always confused with relative and absolute paths in CI/CD pipelines, I would suggest you should always go for relative path. Why?
80-85% CI/CD provider keeps their pwd to the repository itself and there are lot of things happening behind the scenes for running that pipeline job.
So, best option is to go with relative path.
There is no hard-and-fast rule to follow here, just follow what works for you.
First and foremost keep the title of the post shorter.
Confusing relative paths in deploying the site. Want to deploy site without the folder "public" in GitLab?
Sounds good?
Hello Mikhail Maksaimer, please forgive me for pinging you. I hope it do not bother you. I pinged you, because I saw you may know GitLab's YAML.
Yashu Mittal
Full Stack Dev
I must say, GitLab CI/CD syntax is truly weird now when we compare it with GitHub Actions.
I have few questions
Have you already pushed a public directory start to your repository, or you want the GitLab CI/CD to build your site and then deploy it.
Secondly, I don't understand, why are you using?