Deploy your website from Github/Gitlab actions with Hostme

Here are steps to deploy your website to Hostme using Github/Gitlab actions

What are Github actions (or Gitlab CI) ?

GitHub Actions are event-driven, meaning that you can run a series of commands after a specified event has occurred. For example, every time someone creates a pull request for a repository, you can automatically run a command that executes a software testing script.

How to set up the deployment stage on Github/Gitlab actions and deploy to Hostme ?

1. Register to Hostme (and activate your account)

2. Get your API Tokens : On your admin page, you have a section "Advanced" with API Tokens menu, click there, then click on "+  Generate new token". You will have a modal with a token, copy this token to a secured place.

3. Then you can add this code to your .yml file

curl -v -X POST -H "Accept: application/json" -H "Authorization: Bearer <your API Token>" -F "file=@./<your zip file>.zip"<your project slug name>/deploy_on_push

Full example : Angular Project deployed with Gitlab CI

On our Angular project, we add a gitlab-ci.yml.
This file contains the code below : 

# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# This specific template is located at:

# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.

  untracked: true
    - node_modules/

stages:      # List of stages for jobs, and their order of execution
  - install_build_and_deploy

  stage: install_build_and_deploy
  image: node:12-alpine
    - docker
    - npm install @angular/cli
    - npm install
    - apk add zip unzip curl
    - echo "Compiling the code..."
    - ./node_modules/.bin/ng build --prod
    - echo "Compile complete."
    - cp ./.htaccess dist/ecommerce-angular-template/.htaccess
    - echo "Deploying application..."
    - cd dist/ecommerce-angular-template
    - zip -r .
    - mv ../../
    - cd ../../
    - ls -al
    - |
      curl -v -X POST -H "Accept: application/json" -H "Authorization: Bearer 1|r5FyY51ezlIWELsKbfwbPfM9i7vVLVFoiEVbRmef1" -F "file=@./"

Share your response

0 Responses on this post

New project ?

Easily host your website with Hostme. Want to know more about how it works ?