update_projects #21
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 Projects | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: [update_projects] | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
env: | |
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true | |
concurrency: | |
group: "update_projects" | |
cancel-in-progress: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set up Google Service Account Key | |
env: | |
GOOGLE_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }} | |
GOOGLE_SHEET_ID: ${{ secrets.GOOGLE_SHEET_ID }} | |
run: | | |
echo "$GOOGLE_SERVICE_ACCOUNT_KEY" > credentials.json | |
- name: Run update_projects script | |
run: | | |
python update_projects.py | |
- name: Commit and push changes | |
run: | | |
git config --global user.email "harmonizedmri@gmail.com" | |
git config --global user.name "HarmonizedMRI" | |
git add _data/projects.csv assets/logos/* | |
git commit -m "Update projects.csv and logos" | |
git pull --rebase origin main | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Wait for changes to be recognized | |
run: sleep 30 | |
- name: Trigger Jekyll Build and Deploy | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/HarmonizedMRI/HarmonizedMRI.github.io/actions/workflows/jekyll.yml/dispatches \ | |
-d '{"ref":"main"}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |