Skip to content

3c6e5c470c399ac335575c3193fb0fb06dde6b09 #415

3c6e5c470c399ac335575c3193fb0fb06dde6b09

3c6e5c470c399ac335575c3193fb0fb06dde6b09 #415

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