Skip to content

Auto-Update webscrape #752

Auto-Update webscrape

Auto-Update webscrape #752

# This is a basic workflow to help you get started with Actions
name: Generate JSONs for release branch
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
#schedule:
# - cron: "*/5 * * * *"
push:
branches:
- master
permissions:
contents: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout tools
uses: actions/checkout@v4
with:
repository: toniebox-reverse-engineering/tonies-json-tools
path: tonies-json-tools
ssh-key: ${{ secrets.TONIES_JSON_TOOLS_PRIVATE_SSH_KEY }}
- name: Checkout YAMLs
uses: actions/checkout@v4
with:
repository: toniebox-reverse-engineering/tonies-json
path: tonies-json
- name: Checkout tonies.json release Repo
uses: actions/checkout@v4
with:
repository: toniebox-reverse-engineering/tonies-json
ref: release
path: tonies-json-release
- name: Checkout auth
uses: actions/checkout@v4
with:
repository: toniebox-reverse-engineering/tonies-json-auth
path: tonies-json-auth
ssh-key: ${{ secrets.TONIES_JSON_AUTH_PRIVATE_SSH_KEY }}
- name: Delete old artifacts tonies-json-release
run: |
cd tonies-json-release
rm -f tonies.json toniesV2.json
- name: Prepare python
run: |
pip install requests protobuf
- name: Prepare directories
run: |
cd tonies-json-tools
./create_dirs.py
- name: Run yaml2tonies-json.py
run: |
cd tonies-json-tools
./yaml2tonies-json.py
- name: Run stats.py
run: |
cd tonies-json-tools
./stats.py
- name: Check if files exist
run: |
cd tonies-json-release
if [ -f "tonies.json" ] && [ -f "toniesV2.json" ]; then
echo "Files tonies.json and toniesV2.json exist."
else
echo "Files tonies.json and toniesV2.json do not exist."
exit 1
fi
- name: Configure Git
run: |
git config --global user.email "scilor@users.noreply.github.com"
git config --global user.name "SciLor"
- name: Commit and push if changed
run: |
cd tonies-json-release
if [[ -n $(git status --porcelain) ]]; then
git add .
git commit -m "Auto-Update tonies.json, toniesV2.json and the stats"
git pull --rebase
git push
else
echo "No changes to commit and push."
fi