Skip to content

Commit 4bd1944

Browse files
author
elonz
committed
deploy: add build workflow
Change-Id: I39576454e550f360a1d05c21ae9241e38b60e418
1 parent ff9eef7 commit 4bd1944

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.github/workflows/deploy.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: GitHub Pages deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
checkout-and-deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout # Checkout项目
11+
uses: actions/checkout@master
12+
- name: Set up Node.js # Nodejs版本
13+
uses: actions/setup-node@master
14+
with:
15+
node-version: 12.13.0
16+
- name: Install and Build
17+
run: |
18+
npm install
19+
npm run docs:build
20+
- name: Deploy to GitHub Pages
21+
uses: JamesIves/[email protected]
22+
with:
23+
branch: gh-pages
24+
folder: docs/.vuepress/dist

deploy.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env sh
2+
3+
# 确保脚本抛出遇到的错误
4+
set -e
5+
6+
# 生成静态文件
7+
npm run docs:build
8+
9+
# 进入生成的文件夹
10+
cd docs/.vuepress/dist
11+
12+
# 如果是发布到自定义域名
13+
# echo 'www.example.com' > CNAME
14+
15+
git init
16+
git add -A
17+
git commit -m 'deploy'
18+
19+
# 如果发布到 https://<USERNAME>.github.io
20+
# git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master
21+
22+
# 如果发布到 https://<USERNAME>.github.io/<REPO>
23+
git push -f [email protected]:imageslr/regexone-cn.git master:gh-pages
24+
25+
cd -

docs/.vuepress/config.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module.exports = {
2+
base: "/regexone-cn/",
3+
24
title: "RegexOne 中文 - 通过简单的交互式练习来学习正则表达式",
35
description: "通过简单的交互式练习来学习正则表达式|regexone.com 中文翻译",
46
head: [

docs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ actionLink: /lesson/introduction_and_abcs
77
---
88

99
<Exercise
10+
style="max-width: 750px"
1011
title="练习 1:匹配字符"
1112
:data='[{type: "match", text: "abcdefg"}, {type: "match", text: "abcde"}, {type: "match", text: "abc"}]'
1213
solutionText="输入前三个字符"

0 commit comments

Comments
 (0)