在 Gitlab 中建立壓寶計劃的網頁

如何利用 gitlab pages 顯示《壓寶計劃》網頁?

搭配 gitlab 可以使用 git 上傳壓寶計劃的網頁,並且充分利用版本控制的功能維護網頁內容。

 在 gitlab  pages 顯示的壓寶計劃網頁

在登入 gitlab 後,加入新的專案,選擇建立靜態網站結構,專案名字:"ya-bao-project"。
在專案根目錄建立
index.html
.gitlab-ci.yml

index.html(最簡單版本)

例如:
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<title>壓寶計劃</title>
</head>
<body>
<h1>壓寶計劃</h1>
<p>策略展示與數據分析頁面</p>
</body>
</html> 

設定 GitLab Pages(.gitlab-ci.yml)

GitLab Pages 必須透過 CI/CD 部署。

建立 .gitlab-ci.yml
pages:
stage: deploy
script:
- mkdir public
- cp -r * public
artifacts:
paths:
- public
only:
- main

Push 到 GitLab

git init
git add .
git commit -m "init yabao project"
git branch -M main
git remote add origin https://gitlab.com/你的帳號/ya-bao-project.git
git push -u origin main
 

開啟 GitLab Pages

  1. 進入 GitLab 專案
  2. 點擊 Settings → Pages
  3. 部署成功後,會看到網址:
例如: https://every-push.gitlab.io/ya-bao-project/index.html

留言

這個網誌中的熱門文章

計算碟形端板的內容積/calculate internal volume of spherically dished

如何準備使用者設計需求/UDR

壓寶計劃:如何設計桶槽的容積刻度尺/ How to design the volume scale of the barrel tank