Skip to content

Commit 3379968

Browse files
committed
chore: use idoc build website.
1 parent 9c5a677 commit 3379968

File tree

5 files changed

+120
-33
lines changed

5 files changed

+120
-33
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,60 @@
1-
name: Build
1+
name: CI
22
on:
33
push:
44
branches:
55
- master
66

77
jobs:
8-
website:
9-
runs-on: ubuntu-20.04
8+
build:
9+
runs-on: ubuntu-18.04
1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v2
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
1313
with:
14-
node-version: 14
14+
node-version: 16
1515

16-
- run: mkdir -p build build/examples
17-
- run: cp -rp examples build/examples
18-
- run: cp -rp img build/
16+
- run: npm install
17+
- run: npm run build
1918

2019
- name: Generate Contributors Images
2120
uses: jaywcjlove/github-action-contributors@main
2221
with:
2322
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
24-
output: build/CONTRIBUTORS.svg
23+
output: dist/CONTRIBUTORS.svg
2524
avatarSize: 42
2625

27-
- name: Converts Markdown to HTML
28-
uses: jaywcjlove/markdown-to-html-cli@main
26+
- name: Create Tag
27+
id: create_tag
28+
uses: jaywcjlove/[email protected]
2929
with:
30-
source: README.md
31-
output: build/index.html
30+
package-path: ./package.json
3231

33-
- name: Deploy
32+
- name: Deploy Website
3433
uses: peaceiris/actions-gh-pages@v3
3534
with:
35+
user_name: 'github-actions[bot]'
36+
user_email: 'github-actions[bot]@users.noreply.github.com'
37+
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
3638
github_token: ${{ secrets.GITHUB_TOKEN }}
37-
publish_dir: ./build
39+
publish_dir: ./dist
40+
41+
- name: Generate Changelog
42+
id: changelog
43+
uses: jaywcjlove/[email protected]
44+
with:
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
47+
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease)
48+
49+
- name: Create Release
50+
uses: ncipollo/release-action@v1
51+
if: steps.create_tag.outputs.successful
52+
with:
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
name: ${{ steps.create_tag.outputs.version }}
55+
tag: ${{ steps.create_tag.outputs.version }}
56+
body: |
57+
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/vim-web/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
58+
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
59+
60+
${{ steps.changelog.outputs.changelog }}

.gitignore

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,32 @@ DerivedData
1818
*.ipa
1919
*.xcuserstate
2020
*.xcscmblueprint
21-
.DS_Store
21+
.DS_Store
22+
23+
24+
dist
25+
node_modules
26+
test/out
27+
28+
npm-debug.log*
29+
lerna-debug.log
30+
yarn-error.log
31+
package-lock.json
32+
33+
.DS_Store
34+
.cache
35+
.vscode
36+
.idea
37+
38+
*.bak
39+
*.tem
40+
*.temp
41+
#.swp
42+
*.*~
43+
~*.*
44+
45+
# IDEA
46+
*.iml
47+
*.ipr
48+
*.iws
49+
.idea/

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
<!--idoc:ignore:start-->
12
Swift入门教程、读书笔记
23
===
4+
<!--idoc:ignore:end-->
5+
6+
[![CI](https://github.com/jaywcjlove/swift-tutorial/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/swift-tutorial/actions/workflows/ci.yml)
37

48
如果你已经掌握了一些 Swift 语法基础了,可以通过 [SwiftUI Example](https://github.com/jaywcjlove/swiftui-example) 来练习一些示例进行技术的提升。
59

10+
<!--idoc:config:
11+
favicon: ./swift.svg
12+
logo: ./swift.svg
13+
editButton:
14+
label: Edit this page on GitHub
15+
url: https://github.com/jaywcjlove/swift-tutorial/blob/master/
16+
footer: |
17+
Released under the MIT License. Copyright © 2022 Kenny Wong<br />
18+
Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a> v{{idocVersion}}
19+
-->
20+
21+
<!--idoc:ignore:start-->
22+
623
## 示例目录
724

825
- [准备环境](#准备环境)
@@ -26,6 +43,8 @@ Swift入门教程、读书笔记
2643
- [Web框架](#web框架)
2744
- [参考教程](#参考教程)
2845

46+
<!--idoc:ignore:end-->
47+
2948
## 准备环境
3049

3150
在 Mac 上学习 Swift 非常简单,你只需在 App Store 中安装 [Xcode](https://itunes.apple.com/cn/app/xcode/id497799835) 即可。接下来,你有两种方法来学习 Swift 基础语法。
@@ -107,15 +126,15 @@ Swift注释与JS注释一样。
107126

108127
段落注释
109128

110-
```
129+
```swift
111130
/*
112131
这里是段落注释
113132
*/
114133
```
115134

116135
单行注释
117136

118-
```
137+
```swift
119138
// 这里是单行注释
120139
```
121140

@@ -191,7 +210,7 @@ print(variableNumber) // 将 variableNumber 最终的值输出
191210

192211
运行结果
193212

194-
```
213+
```bash
195214
$ swift examples/demo5.swift
196215
1986
197216
```
@@ -211,7 +230,7 @@ print("Hello " + "Swift!") // 输出 Hello Swift!
211230

212231
运行结果
213232

214-
```
233+
```bash
215234
$ swift examples/demo6.swift
216235
6
217236
12
@@ -225,7 +244,7 @@ Hello Swift!
225244

226245
比如下面这样的代码,我们完全可以使用组合赋值运算符简写。
227246

228-
```
247+
```swift
229248
var variableNumber = 13
230249

231250
// 这句是可以使用组合赋值运算符简写
@@ -311,7 +330,7 @@ print(a || b) // 输出 true
311330

312331
在前面的例子中使用了`let``var` 声明常量和变量,并给这个常量或者变量赋值,Swift 默认情况直接根据后面的赋值,来确定这个变量或者常量的类型,这个是Swift的一个简写方式。那么完整的一个声明变量或常量,是下面的样子[demo11.swift](examples/demo11.swift)
313332

314-
```
333+
```swift
315334
let constNumber: Int = 1987
316335
var name : String = "我是调调!"
317336

@@ -470,7 +489,7 @@ A = "This is hello"
470489
print(A)
471490
```
472491

473-
```
492+
```bash
474493
$ swift examples/demo16.swift
475494
examples/demo16.swift:3:5: error: cannot assign value of type 'String' to type 'Int'
476495
A = "This is hello"

package.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
{
2-
"markdown-to-html": {
3-
"github-corners": "https://github.com/jaywcjlove/swift-tutorial",
4-
"document": {
5-
"title": "Swift 入门教程、读书笔记",
6-
"meta": [
7-
{ "description": "通过简单的例子,来快速入门 Swift 语言基础编程、语法等各种语言特性,主要面向新手级别的学习者。" },
8-
{ "keywords": "swift,tutorial,swift-tutorial" }
9-
]
10-
}
2+
"$schema": "https://json.schemastore.org/package.json",
3+
"private": true,
4+
"name": "swift-tutorial",
5+
"title": "Swift 入门教程、读书笔记",
6+
"description": "通过简单的例子,来快速入门 Swift 语言基础编程、语法等各种语言特性,主要面向新手级别的学习者。",
7+
"version": "1.0.0",
8+
"scripts": {
9+
"start": "idoc --watch",
10+
"build": "idoc"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/jaywcjlove/swift-tutorial"
15+
},
16+
"keywords": [
17+
"swift",
18+
"tutorial",
19+
"swift-tutorial"
20+
],
21+
"dependencies": {
22+
"idoc": "^1.10.11"
1123
}
1224
}

swift.svg

Lines changed: 5 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)