DEV Community

Harish Sarangan
Harish Sarangan

Posted on

Steps to host the HTML project

Step1: Login into the GIT Lab
Step2: Create a new group using + icon at the top left near to the user icon
Step3: Create a new project under the created group during project creation set the visibility as public and initialize the project with readme file
Step4: Open the file explorer and navigate to the folder where you need to pull the created project
Step5: Open the cmd prompt from the folder or open the cmd prompt and navigate to that folder using cd cmd
Step6: Use the cmd git pull "repository url"
Step7: Now paste your html file under the workspace or create a new html project under that workspace and name the html file as index.html
Step8: Create a new file using the name gitlab-ci.yml and use the code as mentioned below. Spacing also should be as it is

pages:
  stage: deploy
  script:
    - mkdir public
    - cp index.html public/
  artifacts:
    paths:
      - public
  only:
    - main
Enter fullscreen mode Exit fullscreen mode

Step9: Now commit your changes to your gitlab follow the cmd
Git add .
Git commit -m "Add your message"
Git push origin main
Step10: After pushing click on deploy->Pages
Step11: It will ask for 4 step to host the project
1. Under Select your build image - Enter the value as nginx:alpine
2. in step2 it is asking for installation steps - Enter the value as echo "No installation needed"
3. In step 3 under build need - Enter the value as echo "No build needed"
4. It will ask to publish the directory before publishing go to setting->General setting -> under Project visibility select access to everyone so that after hosting everyone can access the url

At the end of step 9 pipeline will get triggered and URL will be created for your project

Top comments (2)

Collapse
 
payilagam_135383b867ea296 profile image
Payilagam

Good record, which would be useful for every beginner!

Collapse
 
arokiya_kithiyon_1f2bad36 profile image
Arokiya Kithiyon

Nice