Skip to content

f7bebe3b24d0e79cb2bcab0c9de5005944724b90 #413

f7bebe3b24d0e79cb2bcab0c9de5005944724b90

f7bebe3b24d0e79cb2bcab0c9de5005944724b90 #413

Workflow file for this run

name: update sdks
on:
push:
branches:
- '**'
jobs:
update_sdk:
runs-on: ubuntu-20.04
strategy:
matrix:
sdk: [['neurostore-python-sdk', 'python'], ['neurosynth-compose-python-sdk', 'python'], ['neurostore-typescript-sdk', 'typescript'], ['neurosynth-compose-typescript-sdk', 'typescript']]
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Checkout current SDK code
uses: actions/checkout@v3
with:
repository: neurostuff/${{ matrix.sdk[0] }}
path: ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
- name: Checkout reciprical branch
run: |
cd ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
git fetch
git ls-remote --exit-code --heads origin ${{ github.ref_name }} || git branch ${{ github.ref_name }}
git checkout ${{ github.ref_name }}
- name: Generate SDK
run: |
./generate.sh ${{ matrix.sdk[0] }}
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 45
- name: Add and commit changes
run: |
cd ${{ matrix.sdk[1] }}/${{ matrix.sdk[0] }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git config --local --unset-all "http.https://github.com/.extraheader"
# check to see if there were any changes to the repository and no branches made
if [ -z "$(git ls-files --others --exclude-standard --directory --unmerged --modified)" ]; then
echo "No files to be committed!"
if [ -z "$(git ls-remote --heads origin ${{ github.ref_name }})" ]; then
git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.ref_name }}
else
echo "branch already exists and is up to date"
fi
else
git add -A && git commit -m "${{ github.sha }}" -a
git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ matrix.sdk[0] }}.git ${{ github.ref_name }}
fi