Skip to content

Commit 5114717

Browse files
committed
feat: add github pages
1 parent da11820 commit 5114717

File tree

4 files changed

+149
-1
lines changed

4 files changed

+149
-1
lines changed

src/.vuepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default defineUserConfig({
3434
scopeName: "source.webgal",
3535
path: path.resolve(__dirname, "../grammar/webgal.tmLanguage.json"),
3636
},
37-
"ts", "bash", "json", "xml", "kotlin",
37+
"ts", "bash", "json", "xml", "kotlin", "yaml"
3838
],
3939

4040
}),

src/en/publish/web/readme.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,55 @@
44

55
Select Export to Web in the upper right corner of the editor. The deployment method of the web page is the same as that of deploying a normal website. You can purchase cloud servers (Tencent Cloud, Alibaba Cloud) for deployment or use GitHub Pages.
66

7+
### GitHub Pages
8+
9+
1. Create a repository on GitHub and clone it to your local machine.
10+
11+
2. `Copy all` the exported project source files to the root directory of the cloned repository.
12+
13+
3. In the `.github/workflows` directory of the cloned repository, create a file named `deploy.yml`, and its content should be as follows:
14+
```yaml
15+
name: WebGal Web Deploy to GitHub Pages
16+
17+
on:
18+
push:
19+
branches:
20+
- main # The workflow is triggered when pushed to the main branch
21+
workflow_dispatch: # Allows manual triggering of the workflow
22+
23+
permissions:
24+
contents: read
25+
pages: write
26+
id-token: write
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Upload Pages artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: ./ # You can also customize the file upload path (if you change the path)
39+
40+
deploy:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4
50+
```
51+
52+
4. In the `Pages` menu item under the storage repository settings you created, select `Build and deployment > Source > GitHub Actions`. This will enable `GitHub Actions`
53+
54+
5. Push the code to the `main` branch and wait for the `GitHub Action` to complete. You should see the site deployed to `https://<username>.github.io/[repository]/` or `https://<custom-domain>/`, depending on your settings. From then on, the deployment will be automatically triggered every time you push to the `main` branch.
55+
756
## If you use **Release Version**
857

958
Copy the files under /WebGAL (not the folder, the files under the /WebGAL folder) to the specified directory of the cloud server you want to deploy, or deploy to GitHub Pages.

src/ja/publish/web/readme.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,55 @@
44

55
エディタの右上にある「Web にエクスポート」を選択します。Web のデプロイ方法は、通常の Web サイトをデプロイする方法と変わりません。クラウドサーバー(Tencent Cloud、Alibaba Cloud など)を購入してデプロイするか、GitHub Pages を使用することができます。
66

7+
### GitHub Pages
8+
9+
1. GitHub上にリポジトリを作成し、そのリポジトリをローカルに複製します。
10+
11+
2.エクスポートしたソースファイルをクローンリポジトリのルートディレクトリに`すべてコピーします`
12+
13+
3.クローンリポジトリの`.github/workflows`ディレクトリに`deploy.yml`というファイルを作成します。
14+
```yaml
15+
name: WebGal Web Deploy to GitHub Pages
16+
17+
on:
18+
push:
19+
branches:
20+
- main # ワークフローは、mainブランチにプッシュされるとトリガされます。
21+
workflow_dispatch: # 手動でワークフローをトリガーできるようにしました
22+
23+
permissions:
24+
contents: read
25+
pages: write
26+
id-token: write
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Upload Pages artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: ./ # アップロードするファイルのパスをカスタマイズすることもできます(パスを変更した場合)。
39+
40+
deploy:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4
50+
```
51+
52+
4. 作成したリポジトリの `Pages` メニューから`Build and deployment > Source > GitHub Actions`を選択します。
53+
54+
5. `main` ブランチにプッシュして `GitHub Action` が完了するまで待ちます。サイトは`https://<username>.github.io/[repository]/`または`https://<custom-domain>/`に配置されています。設定によります。以後、`main`ブランチにプッシュされるたびに自動的に配置されます。
55+
756
## **リリース版** を使用している場合
857

958
/WebGAL の下にあるファイル(フォルダではなく、/WebGAL フォルダの下にあるファイル)を、デプロイしたいクラウドサーバーの指定されたディレクトリにコピーするか、GitHub Pages にデプロイします。

src/publish/web/readme.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,56 @@
44

55
在编辑器右上角选择导出为网页。网页的部署方式,与部署一个正常网站的方式无异。你可以购买云服务器(腾讯云、阿里云)等部署或使用 GitHub Pages。
66

7+
### GitHub Pages
8+
9+
1. 在 GitHub 上创建一个仓库,将仓库克隆到本地。
10+
11+
2. 将导出的项目源文件`全部复制`到克隆仓库的根目录下。
12+
13+
3. 在克隆仓库的 `.github/workflows` 目录中创建一个名为 `deploy.yml` 的文件,它的内容应该如下:
14+
```yaml
15+
name: WebGal Web Deploy to GitHub Pages
16+
17+
on:
18+
push:
19+
branches:
20+
- main # 当推送到 main 分支时触发工作流
21+
workflow_dispatch: # 允许手动触发工作流
22+
23+
permissions:
24+
contents: read
25+
pages: write
26+
id-token: write
27+
28+
jobs:
29+
build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Upload Pages artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: ./ # 你也可以自定义上传的文件路径(如果你更改了路径的话)
39+
40+
deploy:
41+
needs: build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: github-pages
45+
url: ${{ steps.deployment.outputs.page_url }}
46+
steps:
47+
- name: Deploy to GitHub Pages
48+
id: deployment
49+
uses: actions/deploy-pages@v4
50+
```
51+
52+
4. 在你创建的仓库存储库设置中的`Pages`菜单项下,选择`Build and deployment > Source > GitHub Actions`,这样它将开启 `GitHub Actions`
53+
54+
5. 推送到 `main` 分支并等待 `GitHub Action` 完成。你应该看到站点部署到 `https://<username>.github.io/[repository]/` 或 `https://<custom-domain>/`,这取决于你的设置。此后每次推送到 `main` 分支时自动部署。
55+
56+
757
## 如果你使用**发行版**
858

959
复制/WebGAL 下的文件(不是文件夹,是/WebGAL 文件夹下的文件)到你想要部署的云服务器的指定目录下,或是部署到 GitHub Pages。

0 commit comments

Comments
 (0)