openMINDS_build_pipeline #519
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
# MIT licensed | |
name: openMINDS_build_pipline | |
on: | |
push: | |
branches: | |
- pipeline | |
workflow_dispatch: # This triggers the workflow when a webhook is received | |
inputs: | |
branch: | |
description: 'The branch of the submodule the workflow was triggered for' | |
required: true | |
type: string | |
repository: | |
description: 'The repository of the submodule the workflow was triggered for' | |
required: true | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Run build | |
run: | | |
pip install -r requirements.txt | |
python build.py --repository "${{ inputs.repository }}" --branch "${{ inputs.branch }}" --config versions.json | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
path: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to main | |
run: | | |
cp -R target/* main | |
cd main | |
git config --global user.email "[email protected]" | |
git config --global user.name "openMINDS pipeline" | |
if [[ $(git add . --dry-run | wc -l) -gt 0 ]]; then | |
git add . | |
git commit -m "build triggered by submodule ${{ inputs.repository }} version ${{ inputs.branch }}" | |
git push -f | |
else | |
echo "Nothing to commit" | |
fi | |