Skip to content

Generate JSONs for release branch #2

Generate JSONs for release branch

Generate JSONs for release branch #2

# 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:
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
- uses: actions/checkout@v4
with:
repository: toniebox-reverse-engineering/tonies-json
path: tonies-json
- uses: actions/checkout@v4
with:
repository: toniebox-reverse-engineering/tonies-json
ref: release
path: tonies-json-release
- name: Delete old artifacts tonies-json
run: |
cd tonies-json
rm -f tonies.json toniesV2.json
- name: Delete old artifacts tonies-json-release
run: |
cd tonies-json-release
rm -f tonies.json toniesV2.json
- name: Run yaml2tonies-json.py
run: |
cd tonies-json
./yaml2tonies-json.py
mv tonies.json ../tonies-json-release/
mv toniesV2.json ../tonies-json-release/
- 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 and toniesV2.json"
git push
else
echo "No changes to commit and push."
fi