Build for Cheats.rs #743
This file contains 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 for Cheats.rs | |
on: | |
# push: | |
# branches: | |
# - master | |
schedule: | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
repository_dispatch: | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install zola | |
run: | | |
wget -c https://github.com/getzola/zola/releases/download/v0.14.1/zola-v0.14.1-x86_64-unknown-linux-gnu.tar.gz | |
tar xf zola-v0.14.1-x86_64-unknown-linux-gnu.tar.gz | |
mv zola /usr/local/bin | |
- name: Clone cheats.rs book | |
run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/ralfbiedert/cheats.rs.git cheats.rs-en | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone cheats.rs book | |
run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/kingfree/cheats.rs.git cheats.rs-zh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: init oss config | |
uses: yizhoumo/setup-ossutil@v1 | |
with: | |
ossutil-version: '1.7.3' | |
endpoint: ${{secrets.OSS_ENDPOINT}} | |
access-key-id: ${{secrets.OSS_ID}} | |
access-key-secret: ${{secrets.OSS_SECRET}} | |
sts-token: "" | |
- name: Build cheats.rs book | |
run: | | |
# Build cheats.rs book | |
mkdir -pv cheats.rs-archive/{en,zh} | |
cd cheats.rs-en && \ | |
/usr/local/bin/zola build && \ | |
cp -ar public/* ../cheats.rs-archive/en/ | |
cd ../cheats.rs-zh && \ | |
/usr/local/bin/zola build && cp -ar public/* ../cheats.rs-archive/zh/ | |
# Upload to oss | |
ls -alhtr && cd .. && \ | |
ossutil sync cheats.rs-archive/ oss://${{ secrets.OSS_BUCKET }}/cheats.rs/ -f --delete | |
- name: Sending Build Status | |
if: always() | |
env: | |
DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }} | |
DINGTALK_SECRET: ${{ secrets.DINGTALK_SECRET }} | |
JOB_STATE: ${{ job.status }} | |
RUNNER_OS: ${{ runner.os }} | |
GITHUB_REF: ${{ github.ref }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_WORKFLOW: ${{ env.GITHUB_WORKFLOW }} | |
run: python3 notify.py |