Update website #1
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: Update website | |
on: | |
workflow_dispatch: | |
#push: | |
# branches: [ "main" ] | |
#pull_request: | |
# branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
if [ -f .github/scripts/requirements.txt ]; then | |
pip install -r .github/scripts/requirements.txt | |
fi | |
- name: Run script | |
env: | |
SIS_COURSE_API_ID: ${{ secrets.SIS_COURSE_API_ID }} | |
SIS_COURSE_API_KEY: ${{ secrets.SIS_COURSE_API_KEY }} | |
SIS_SUBJECT_AREA: ${{ vars.SIS_SUBJECT_AREA }} | |
SIS_CATALOG_NUMBER: ${{ vars.SIS_CATALOG_NUMBER }} | |
AUTHOR: ${{ vars.AUTHOR }} | |
GOOGLE_ANALYTICS_TAG: ${{ vars.GOOGLE_ANALYTICS_TAG }} | |
COURSE_DATA_FILE: ${{ vars.COURSE_DATA_FILE || '/dev/null' }} | |
run: | | |
python .github/scripts/render-templates.py \ | |
--subject-area=${SIS_SUBJECT_AREA} \ | |
--catalog-number=${SIS_CATALOG_NUMBER} \ | |
--author=${AUTHOR} \ | |
--google-analytics-tag=${GOOGLE_ANALYTICS_TAG} \ | |
--course-data-file=${COURSE_DATA_FILE} | |
- name: Configure git identity | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GIT_NAME: ${{ vars.GIT_NAME }} | |
GIT_EMAIL: ${{ vars.GIT_EMAIL }} | |
run: | | |
git config --global user.name "${GIT_NAME}" | |
git config --global user.email "${GIT_EMAIL}" | |
- name: Stage changes | |
run: git add . | |
- name: Commit changes | |
run: | | |
git commit -m "Update via GitHub Actions." | |
- name: Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push |