Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chai2010 committed Aug 5, 2024
0 parents commit 894900f
Show file tree
Hide file tree
Showing 258 changed files with 49,744 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2017 <chaishushan{AT}gmail.com>. All rights reserved.
# Use of this source code is governed by a Apache
# license that can be found in the LICENSE file.

# http://editorconfig.org/

root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = false

[*]
indent_style = tab

[*.{go,proto}]
charset = utf-8
indent_style = tab

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

[*.yaml]
indent_style = space
indent_size = 2
56 changes: 56 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: mdbook
on:
push:
branches:
- main
- master
- "releases/*"
pull_request:
branches:
- main
- master
types:
- closed
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.10'
# mdbook-version: 'latest'
# 安装 build pdf 依赖和中文字体
- run: sudo apt update && sudo apt install chromium-browser wget unzip fonts-wqy-microhei ttf-wqy-zenhei -y
# 下载 mdbook-pdf 二进制文件, 编译太花时间了
- run: |
export mdbook_download_url=$(curl -s 'https://api.github.com/repos/HollowMan6/mdbook-pdf/releases?per_page=1&page=1' | python3 -c "import sys, json;import pprint;tmp=[print(x['browser_download_url']) if 'x86_64-unknown-linux-gnu' in x['name'] else None for x in json.load(sys.stdin)[0]['assets']]")
wget $mdbook_download_url
unzip mdbook*.zip
rm mdbook*.zip
chmod +x mdbook-pdf
sudo mv mdbook-pdf /bin
# build
- run: |
mdbook build
mv book/pdf/output.pdf ./Go语言高级编程.pdf
rm -r book/pdf/ && mv book/html/* book/ && rm -r book/html
- name: Automatic Releases
uses: marvinpinto/[email protected]
with:
# 将 pdf 文件 release
repo_token: ${{ secrets.MY_DEPLOY_KEY }}
automatic_release_tag: AutoBuild
title: Go语言高级编程PDF
files: "Go语言高级编程.pdf"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.MY_DEPLOY_KEY }}
publish_dir: ./book/
publish_branch: gh-pages
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
Empty file added .nojekyll
Empty file.
Binary file added 163study-go-master.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added A20181610.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2017, chai2010
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2016 <chaishushan{AT}gmail.com>. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

#
# fix gitbook build error on macOS([email protected] and [email protected])
#
# gitbook fetch 3.2.3
# gitbook build --gitbook=3.2.3
#
# https://github.com/GitbookIO/gitbook/issues/1774
# https://github.com/GitbookIO/gitbook-cli/blob/master/README.md
#

default:
mdbook serve


build:
-rm book
mdbook build
-rm book/.gitignore
-rm book/.nojekyll
-rm -rf book/.git

deploy:
-@make clean
mnbook build
-rm book/.gitignore
-rm -rf book/.git
-rm -rf book/examples

cd book && git init
cd book && git add .
cd book && git commit -m "first commit"
cd book && git branch -M gh-pages
cd book && git remote add origin [email protected]:chai2010/advanced-go-programming-book.git
cd book && git push -f origin gh-pages

clean:
-rm -rf book
Loading

0 comments on commit 894900f

Please sign in to comment.