-
Notifications
You must be signed in to change notification settings - Fork 52
123 lines (102 loc) · 3.69 KB
/
generate_profile_workflow.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# This workflow will generate/update a/the profile HTML page each time the
# DDE genrates and update a JSON-LD in the _data/specifications folder (repo)
name: generate-profile
on:
push:
branches:
- master
# pull_request:
# types: [opened, reopened]
env:
GH_TOKEN: ${{ secrets.Sahar_Workflows_Token }}
# inputs:
# branch-name:
# description: $`date +%Y_%m_%d-%H_%M_%S`
# required: true
jobs:
generate-profile:
runs-on: ubuntu-latest
steps:
- name: Checkout Spec Repo and Retreive the Preceding Commit
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v21
- name: List Changed Files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8 #install the python needed
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v3
with:
path: "./.github/workflows/requirements.txt"
- name: Checkout the DDE repo
env:
GITHUB_TOKEN: ${{ secrets.Sahar_Workflows_Token }}
run: |
git clone https://user:[email protected]/BioSchemas/bioschemas-dde
cd bioschemas-dde
git checkout main
ls
- name: Checkout the Website repo
env:
GITHUB_TOKEN: ${{ secrets.Sahar_Workflows_Token }}
run: |
git clone https://user:[email protected]/BioSchemas/bioschemas.github.io
cd bioschemas.github.io
git pull
ls
- name: Checkout a new branch - Website repository
run: |
cd bioschemas.github.io
git pull
git checkout -b `date +%Y_%m_%d-%H_%M`
cd ..
- name: Execute the config files update Python Script
run: |
python ./.github/workflows/config_file_update_script.py ${{steps.changed-files.outputs.all_changed_files}}
- name: Execute the profile rendering Python Script
run: |
python ./.github/workflows/profile_generation_script.py ${{steps.changed-files.outputs.all_changed_files}} bioschemas.github.io
- name: Setup the Github TOKEN
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
path: bioschemas.github.io
email: [email protected]
name: sahar-frikha
actor: sahar-frikha
token: '${{secrets.Sahar_Workflows_Token}}'
- name: Commit and Push the changes in the website
run: |
sleep 5
cd bioschemas.github.io
git config user.name "sahar-frikha"
git config user.email "[email protected]"
git status
git add .
git commit -m "Updating Profile"
git push --set-upstream -u origin `date +%Y_%m_%d-%H_%M`
- name: Create a pull request
run: |
sleep 30
cd bioschemas.github.io
gh pr create --title "Auto-Rendering Profile" --body "This pull request has been created by a guithub action, after adding/updating a profile in the specifications repo."
- name: Commit and Push the changes in the DDE repository
run: |
cd bioschemas-dde
git config user.name "sahar-frikha"
git config user.email "[email protected]"
git status
git add .
git commit -m "Updating Profile"
git push origin -f main
- name: End Workflow
run: |
echo "Check the Website !"