Files
dropshell-templates/.gitea/workflows/test-and-publish.yaml
Your Name bedc68373d
Some checks failed
Test and Publish Templates / test-and-publish (push) Failing after 14s
Add 7 and update 2 files
2025-08-24 20:50:58 +12:00

66 lines
2.2 KiB
YAML

name: Test and Publish Templates
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for change detection
- name: Install dependencies
run: |
# Install sos tool for uploading
curl -o /tmp/sos https://getbin.xyz/sos:latest && chmod +x /tmp/sos
sudo mv /tmp/sos /usr/local/bin/sos
# Install jq for JSON parsing
which jq || sudo apt-get update && sudo apt-get install -y jq
# Install tar for packaging
which tar || sudo apt-get update && sudo apt-get install -y tar
- name: Run tests
run: |
chmod +x test.sh
./test.sh
- name: Detect changed templates
id: changes
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
chmod +x detect-changes.sh
CHANGED_TEMPLATES=$(./detect-changes.sh)
if [ -z "$CHANGED_TEMPLATES" ]; then
echo "No templates have changed"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Changed templates: $CHANGED_TEMPLATES"
echo "changed=true" >> $GITHUB_OUTPUT
# Store changed templates for the next step
echo "$CHANGED_TEMPLATES" > changed_templates.txt
fi
- name: Publish changed templates
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.changes.outputs.changed == 'true'
env:
SOS_WRITE_TOKEN: ${{ secrets.SOS_WRITE_TOKEN }}
run: |
chmod +x publish.sh
# Publish only changed templates
./publish.sh --changed-only
- name: Update versions after successful publish
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.changes.outputs.changed == 'true'
run: |
# This step would normally commit the updated versions.json
# But we'll leave this for manual version bumping
echo "Templates published successfully. Consider bumping versions in versions.json for the changed templates."