Skip to content

Github Pages

Github Pages #1597

Workflow file for this run

name: Github Pages
on:
schedule:
- cron: "0 1 * * *"
push:
branches: [master]
permissions:
contents: write
pages: write
id-token: write
jobs:
Archiving:
runs-on: ubuntu-latest
env:
DEPLOY_USER_NAME: Deploy-GitHub-Action
DEPLOY_USER_EMAIL: github_action@pdis.tw
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: ./.github/actions/archiving-images
- uses: ./.github/actions/commit-if-change
with:
commit_user_name: $DEPLOY_USER_NAME
commit_user_email: $DEPLOY_USER_EMAIL
custom_commit_message: >
Auto archive image
Archive and Modify follow file:
- name: Push to remote
run: |
git pull --rebase origin master
git push origin master
Translating:
runs-on: ubuntu-latest
needs: Archiving
env:
DEPLOY_USER_NAME: Deploy-GitHub-Action
DEPLOY_USER_EMAIL: github_action@pdis.tw
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.ENCRYPTED_KEY }}
- uses: ./.github/actions/auto-translation
- uses: ./.github/actions/commit-if-change
with:
commit_user_name: $DEPLOY_USER_NAME
commit_user_email: $DEPLOY_USER_EMAIL
custom_commit_message: >
Auto translate
Generate follow file:
- name: Push to remote
run: |
git pull --rebase origin master
git push origin master
build_deploy:
runs-on: ubuntu-latest
needs: [Archiving, Translating]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
ref: ${{ github.ref }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
find _site -name '*html' -exec sed -i 's/tw\/zh-TW\/assets/tw\/assets/g' {} +
find _site -name '*html' -exec sed -i 's/tw\/en\/assets/tw\/assets/g' {} +
env:
JEKYLL_ENV: production
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site