Build Stacks and Categories #8
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 Stacks and Categories | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # Runs at midnight UTC every day | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Verify and Prepare Scripts | |
run: | | |
if [[ ! -f "utils/build_stacks_array.sh" || ! -f "utils/build_categories_array.sh" ]]; then | |
echo "Error: Scripts missing in utils/ directory!" | |
exit 1 | |
fi | |
chmod +x "utils/build_stacks_array.sh" "utils/build_categories_array.sh" | |
- name: Run Scripts and Check Outputs | |
run: | | |
set -e | |
"utils/build_stacks_array.sh" > "stacks/stacks.json" | |
"utils/build_categories_array.sh" > "stacks/categories.json" | |
for file in "stacks/stacks.json" "stacks/categories.json"; do | |
if [[ ! -s "$file" ]]; then | |
echo "Error: $file is empty or not updated!" | |
exit 1 | |
fi | |
done | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "github-actions@github.com" | |
git add "stacks/stacks.json" "stacks/categories.json" | |
git commit -m "Update stacks.json and categories.json" | |
git push |