Merge pull request #662 from BioSchemas/ljgarcia-patch-1 #271
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
# 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 !" |