Revamp GitHub tag versions, debugging individual projects, and more! #22
Workflow file for this run
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: Validate, Test, and Update | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: "45 1 * * *" | |
jobs: | |
validate-projects-yaml: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Validate projects YAML file | |
run: python -u tools/check_projects_yaml.py | |
test-chert: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Render site | |
run: | | |
output=$(chert render 2>&1) | |
echo "$output" | |
if echo "$output" | grep -q "^E+"; then | |
exit 1 | |
fi | |
update-and-deploy: | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- validate-projects-yaml | |
- test-chert | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Generate updated projects.json file | |
env: | |
GH_USER: github-actions[bot] | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: python -u tools/gen_projects_json.py | |
- name: Test render site | |
run: | | |
output=$(chert render 2>&1) | |
echo "$output" | |
if echo "$output" | grep -q "^E+"; then | |
exit 1 | |
fi | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add projects.json | |
if git diff --cached --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "chore: update project.json [skip ci]" | |
git push origin master | |
fi |