This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
75 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy to static server | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy to static server | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build website | ||
run: npm run build | ||
|
||
- name: upload files | ||
uses: fangbinwei/[email protected] | ||
with: | ||
accessKeyId: ${{ secrets.ACCESSKEY_ID }} | ||
accessKeySecret: ${{ secrets.ACCESSKEY_SECRET }} | ||
bucket: web-toiletmc | ||
endpoint: oss-cn-hangzhou.aliyuncs.com | ||
folder: ./build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Test deployment | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
# Review gh actions docs if you want to further define triggers, paths, etc | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on | ||
|
||
jobs: | ||
test-deploy: | ||
name: Test deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
- name: Test build website | ||
run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,29 @@ | ||
# Website | ||
# 厕所总部の网站 | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
[![Deploy to Aliyun](https://github.com/ToiletMC/toiletmc.net/actions/workflows/deploy.yml/badge.svg)](https://github.com/ToiletMC/toiletmc.net/actions/workflows/deploy.yml) | ||
|
||
### Installation | ||
如果你有兴趣帮助我们改进网站,或是添加一些内容,我们都欢迎 ━(_` ∀´_)ノ亻! | ||
我们的网站完全使用 [Docusaurus 2](https://docusaurus.io/zh-CN/) 生成,一个现代化的静态网站生成器。浏览我们的站点:[toiletmc.net](https://toiletmc.net) | ||
|
||
``` | ||
$ yarn | ||
``` | ||
## 🤔 常见问题 | ||
|
||
### Local Development | ||
### 插入的图片太大了,浪费 CDN 流量怎么办? | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
如果需要插入图片,建议压缩后再添加:[tinify.cn](https://tinify.cn) | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
### 访问 Github 太慢了,有时候根本连不上怎么办? | ||
|
||
### Build | ||
可以使用国内的 [Gitee 镜像仓库](https://gitee.com/toiletmc/toiletmc.net),两个仓库完全同步 :) | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
## 🎖️ 如何贡献 | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
1. 将本仓库 fork 到自己的 github 账号并下载文件到本地 | ||
2. 在文件夹内运行命令 `npm install`,等待依赖文件下载完成 | ||
3. 在文件夹内运行命令 `npm run start` 启动实时预览服务器 | ||
4. 编辑文件,浏览器转到 `localhost:3000` 实时预览页面 | ||
5. 完成所有编辑工作后运行 `npm run build`,测试是否构建通过 | ||
6. 将文件上传到自己仓库,然后向本仓库提交 pr | ||
|
||
### Deployment | ||
## ⚙️ 工作流程 | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. | ||
当检测到 main 分支文件变化时,Github Action 会自动构建网站并完成部署。 |