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