|
| 1 | +#部署 |
| 2 | +name: "linux-publish_techblog-main_web_site" |
| 3 | +on: |
| 4 | + # push: |
| 5 | + # branches: |
| 6 | + # - master |
| 7 | + # paths-ignore: |
| 8 | + # # - .github/workflows/pub_web.yml |
| 9 | + # - .gitignore |
| 10 | + # - README.md |
| 11 | + # - LICENSE |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + pages: write |
| 19 | + id-token: write |
| 20 | + |
| 21 | +# Allow one concurrent deployment |
| 22 | +concurrency: |
| 23 | + group: "pages" |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + build-docs: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + env: |
| 30 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + steps: |
| 32 | + # - name: Checkout |
| 33 | + # uses: actions/checkout@v4 |
| 34 | + # with: |
| 35 | + # fetch-depth: 0 |
| 36 | + # submodules: true |
| 37 | + # Checkout private repo |
| 38 | + - name: Checkout private repo |
| 39 | + uses: actions/checkout@v3 |
| 40 | + with: |
| 41 | + repository: linjonh/TechBlog |
| 42 | + branch: main |
| 43 | + token: ${{ secrets.PAT_TOKEN }} |
| 44 | + path: . |
| 45 | + #build |
| 46 | + - name: Set up Ruby |
| 47 | + uses: ruby/setup-ruby@v1 |
| 48 | + with: |
| 49 | + ruby-version: '3.4.2' # 替换为你项目实际使用的版本 |
| 50 | + bundler-cache: true |
| 51 | + # Install ruby dependencies |
| 52 | + - name: Install dependencies |
| 53 | + run: | |
| 54 | + # cd TechBlog |
| 55 | + gem install bundler |
| 56 | + bundle install --jobs 4 --retry 3 |
| 57 | + - run: bundle exec jekyll build -d "_site${{ steps.pages.outputs.base_path }} --trace" |
| 58 | + env: |
| 59 | + JEKYLL_ENV: production |
| 60 | + #Setup pages |
| 61 | + - name: Setup Pages |
| 62 | + id: pages |
| 63 | + uses: actions/configure-pages@v4 |
| 64 | + # Upload the site artifact |
| 65 | + - name: Upload site artifact |
| 66 | + uses: actions/upload-pages-artifact@v3 |
| 67 | + with: |
| 68 | + path: "_site${{ steps.pages.outputs.base_path }}" |
| 69 | + deploy: |
| 70 | + environment: |
| 71 | + name: github-pages |
| 72 | + url: ${{ steps.deployment.outputs.page_url }} |
| 73 | + runs-on: ubuntu-latest |
| 74 | + needs: build-docs |
| 75 | + steps: |
| 76 | + - name: Deploy to GitHub Pages |
| 77 | + id: deployment |
| 78 | + uses: actions/deploy-pages@v4 |
0 commit comments