小小的筆記本

記錄一些學習筆記,順便學一下怎樣用Markdown來寫Blog。

有興趣的話,你也可以來看看喲。

GitHub Actions的初體驗

前言 什麽是 Actions?反正就是自動化工具,我說的也不準確 去官網看最真實,而且有最豐富的資料,這次也是簡單講解一下。 如何使用 在 Project 的根目錄上建立.github\workflows 的目錄 在該目錄上建立一個或者多個以 yaml 結尾的設定檔即可 .github\workflows<any>.yaml 運行 當 GitHub 發現設定檔後,則會自動執行 所有行為均源自設定檔的配置,無需另外設定 範例 Actions 是由以下元素所組成的: Workflow -> Job -> Step -> Action 每一個元素下都可以含有多數下級元素 由於所有東西都在設定檔內,直接給出 Example 比較好理解 #Workflow的名字 name: Deploy to gh-page on: #什麽時候發動,下面就是push到main或手動執行 push: branches: - main workflow_dispatch: jobs: #Job的名字 hugo_build: name: hugo build and deploy GitHub Pages #運行的環境 runs-on: ubuntu-latest steps: #將你的Code checkout出來 - uses: actions/checkout@v2 with: submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for ....

2022-01-28 · 1 min · Derek.K

Git的Hello World

前言 官網有豐富的文件,在這摘要一下: Git 也分安裝或已經編譯好的檔案,可按此下載。 檢查 Git 版本 git version 初始化 Git 項目 當決定用 Git 管理項目時,必需要對其進行初始化 git init 設定 Git 環境(非必要) 可以為 Git 設定用戶,電件等資訊 git config --global user.name "XXXX" git config --global user.email "xxxx@gmail.com” 查看 config git config --list Clone 已有的資料庫(.git) git clone <repo url> 建立 Git 索引 為工作區(Workspace)內指定檔案建立索引 git add helloworld.txt 為工作區(Workspace)內所有檔案建立索引 git add . Commit 到本地資料庫 Commit 時可以使用-m 附加文字描述 git comit -m "your remark" 建立 branch 如 Commit 前沒有建立 branch,則自動建立一個以 main 命名的分支...

2022-01-18 · 1 min · Derek.K

Hugo的Hello World

Hugo 的安裝 官網有豐富的文件,在這摘要一下: 各平台的 Install guide。 如不想安裝,可直接下載不同版本的 Releases。 檢查 Hugo 版本 hugo version 建立 Hugo 站點 首先建立以 XXXX 命名的 Site Project hugo new site XXXX cd XXXX 套用模版 Hugo 的官網提供了很多模版,找一個自己喜歡的 然後使用以下指令,可把指定的 Theme 下載到你的 Project 中使用 git submodule add https://github.com/aaa/xxxx.git themes/xxxx 當你需要 reclone 時使用,因為 submodules 不會自動下載 git submodule update --init --recursive 其實套用模版的方法很多,裏面都有教學,不過上面的方法就比較不影響現有的東西,然後在 config.toml 中進行設定即可使用 theme="xxxx" 編寫文章 根據相關模版建立新文章 hugo new posts/first.md 由於指令中指定在posts的文件夾中產生文章,所以會根據以下順序去查找模版 archetypes/posts.md archetypes/default.md themes/my-theme/archetypes/posts.md themes/my-theme/archetypes/default.md 啟動 Server, -D 為 development hugo -D server 在瀏覽器中打開http://localhost:1313就可以見到生成的網頁...

2022-01-14 · 1 min · Derek.K