-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (54 loc) · 1.88 KB
/
update_projects.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 }}