Auto-translate /nishio #451
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: Auto-translate /nishio | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 21 * * *' # JST 6:00 | |
env: | |
SID: ${{ secrets.SID }} | |
DEEPL_KEY: ${{ secrets.DEEPL_KEY }} | |
jobs: | |
build: | |
permissions: | |
contents: 'write' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.4' | |
cache: 'pip' # caching pip dependencies | |
- run: pip install -r requirements.txt | |
- uses: denoland/setup-deno@v1 | |
# - name: Remove old pages | |
# run: | | |
# mv -f nishio/pages nishio/old_pages | |
# mv -f nishio/pages_en nishio/old_pages_en | |
# - name: Get new pages | |
# run: > | |
# python main.py | |
- name: Export from Scrapbox(/nishio to data.json) | |
run: ./export_from_scrapbox.sh | |
- name: Translate (data.json to data_en.json) | |
run: python translate.py | |
- name: Make diff (data_en.json and nishio/data_en_prev.json to data_en_diff.json) | |
run: python diff_json.py | |
- name: store previous data | |
run: | | |
mv data.json nishio | |
cp data_en.json nishio/data_en_prev.json | |
- name: Commit files | |
run: ./commit.sh | |
- name: Import to Scrapbox(data_en_diff.json to /nishio-en) | |
run: ./import_to_scrapbox.sh | |
# - name: Set Date | |
# env: | |
# TZ: "Asia/Tokyo" | |
# run: echo "CURRENT_DATETIME=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
# - name: Release | |
# uses: ncipollo/release-action@v1 | |
# with: | |
# artifacts: "data.zip" | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# tag: ${{ env.CURRENT_DATETIME }} |