|
| 1 | +name: Build and deploy vim help |
| 2 | + |
| 3 | +# This is an experimental. |
| 4 | +# |
| 5 | +# gh-pagesブランチを経由せず、actions/upload-pages-artifactを使って直接GitHub Pagesにデプロイする試み |
| 6 | +# pushのたびにいったん artifacts まで作る(HTML生成+Jekyll実行) |
| 7 | +# masterへのpushかcronでの実行であればGitHub Pagesへアップロードする |
| 8 | +# …という計画 |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + |
| 13 | + schedule: |
| 14 | + - cron: '5 12 * * *' |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + steps: |
| 20 | + - name: Setup Vim |
| 21 | + uses: thinca/action-setup-vim@v2 |
| 22 | + with: |
| 23 | + vim_version: 'v9.1.0065' |
| 24 | + vim_type: 'Vim' |
| 25 | + |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + # |
| 30 | + # Generate HTML from Vim documents and upload it as an artifact. |
| 31 | + # |
| 32 | + |
| 33 | + - name: Generate new HTML documents |
| 34 | + run: | |
| 35 | + make html |
| 36 | +
|
| 37 | + - name: Check commit IDs |
| 38 | + id: commitid |
| 39 | + run: | |
| 40 | + echo "vim=$(git -C vim rev-parse HEAD)" >> $GITHUB_OUTPUT |
| 41 | + echo "vim_faq=$(git -C vim_faq rev-parse HEAD)" >> $GITHUB_OUTPUT |
| 42 | +
|
| 43 | + - name: Upload vim generated HTML files as an artifact |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: vim-generated-html |
| 47 | + path: target/html/doc/*.html |
| 48 | + |
| 49 | + # |
| 50 | + # Generate GitHub Page site and upload it as an artifact. |
| 51 | + # |
| 52 | + |
| 53 | + - name: Prepare for building GitHub Page (Jekyll) |
| 54 | + run: |
| 55 | + make jekyll-build-prepare |
| 56 | + |
| 57 | + - name: Build GitHub Page site |
| 58 | + uses: actions/jekyll-build-pages@v1 |
| 59 | + with: |
| 60 | + source: target/jekyll-work |
| 61 | + verbose: true |
| 62 | + |
| 63 | + - name: Upload a site as an artifact |
| 64 | + uses: actions/upload-pages-artifact@v3 |
| 65 | + with: |
| 66 | + path: _site/ |
| 67 | + retention-days: 7 |
| 68 | + |
| 69 | + # Upload a site to GitHub Pages |
| 70 | + deploy: |
| 71 | + needs: |
| 72 | + - build |
| 73 | + environment: |
| 74 | + name: github-pages |
| 75 | + url: ${{ steps.deployment.outputs.page_url }} |
| 76 | + runs-on: ubuntu-22.04 |
| 77 | + permissions: |
| 78 | + contents: read |
| 79 | + pages: write |
| 80 | + id-token: write |
| 81 | + # Run only when updating the master branch or when started by cron. |
| 82 | + if: github.ref == 'refs/heads/master' || github.event_name == 'schedule' |
| 83 | + steps: |
| 84 | + - name: Deploy to Github Pages |
| 85 | + id: deployment |
| 86 | + uses: actions/deploy-pages@v4 |
0 commit comments