Build and Deploy #1015
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build and Deploy" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| paths-ignore: | |
| - .gitignore | |
| - README.md | |
| - LICENSE | |
| workflow_dispatch: | |
| workflow_call: | |
| workflow_run: | |
| workflows: [ZMediumToMarkdown] | |
| types: | |
| - completed | |
| schedule: | |
| - cron: "10 1 * * *" | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| env: | |
| L10n: zh-tw | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # submodules: true | |
| # If using the 'assets' git submodule from Chirpy Starter, uncomment above | |
| # (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets) | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.3 | |
| bundler-cache: true | |
| - name: Setup | |
| run: bash tools/setup.sh | |
| - name: Build site | |
| run: bundle exec jekyll b -d "_site${{ steps.pages.outputs.base_path }}" | |
| env: | |
| JEKYLL_ENV: "production" | |
| MEDIUM_HOST: "${{ secrets.MEDIUM_HOST }}" | |
| MEDIUM_COOKIE_SID: "${{ secrets.MEDIUM_COOKIE_SID }}" | |
| MEDIUM_COOKIE_UID: "${{ secrets.MEDIUM_COOKIE_UID }}" | |
| Analytics_URL: "${{ secrets.Analytics_URL }}" | |
| - name: Test site | |
| run: | | |
| bundle exec htmlproofer "_site${{ steps.pages.outputs.base_path }}" \ | |
| \-\-disable-external \ | |
| \-\-no-enforce-https \ | |
| \-\-ignore-empty-alt \ | |
| \-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/" | |
| - name: Deploy | |
| run: bash tools/deploy.sh | |
| - name: Trigger en deploy | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Bearer $GH_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| https://api.github.com/repos/ZhgChgLi/zhgchgli-en.github.io/actions/workflows/deploy.yml/dispatches \ | |
| -d '{ | |
| "ref": "main" | |
| }' | |
| - name: Trigger cn deploy | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Bearer $GH_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| https://api.github.com/repos/ZhgChgLi/zhgchgli-zh-hans.github.io/actions/workflows/deploy.yml/dispatches \ | |
| -d '{ | |
| "ref": "main" | |
| }' | |
| - name: Trigger jp deploy | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| run: | | |
| curl -X POST \ | |
| -H "Authorization: Bearer $GH_TOKEN" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| https://api.github.com/repos/ZhgChgLi/zhgchgli-jp.github.io/actions/workflows/deploy.yml/dispatches \ | |
| -d '{ | |
| "ref": "main" | |
| }' | |
| # - name: Upload site artifact | |
| # uses: actions/upload-pages-artifact@v3 | |
| # with: | |
| # path: "_site${{ steps.pages.outputs.base_path }}" | |
| # deploy-zh-hans: | |
| # needs: build | |
| # uses: ZhgChgLi/zhgchgli-zh-hans.github.io/.github/workflows/deploy.yml@main | |
| # deploy-en: | |
| # needs: build | |
| # uses: ZhgChgLi/zhgchgli-en.github.io/.github/workflows/deploy.yml@main | |
| # deploy: | |
| # environment: | |
| # name: github-pages | |
| # url: ${{ steps.deployment.outputs.page_url }} | |
| # runs-on: ubuntu-latest | |
| # needs: build | |
| # steps: | |
| # - name: Deploy to GitHub Pages | |
| # id: deployment | |
| # uses: actions/deploy-pages@v4 |