Skip to content

Commit 70ecb8d

Browse files
authored
Merge pull request #1 from neurostuff/test
[TST] add workflow to update sdks
2 parents 0b12d92 + 0dafbfa commit 70ecb8d

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed

.github/workflows/update_sdk.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: update sdks
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
jobs:
7+
update_sdk:
8+
runs-on: ubuntu-20.04
9+
strategy:
10+
matrix:
11+
sdk: [['neurostore-python-sdk', 'python'], ['neurosynth-compose-python-sdk', 'python'], ['neurostore-typescript-sdk', 'typescript'], ['neurosynth-compose-typescript-sdk', 'typescript']]
12+
steps:
13+
- name: Check out repository code
14+
uses: actions/checkout@v3
15+
with:
16+
submodules: true
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v1
19+
- name: Checkout current SDK code
20+
uses: actions/checkout@v3
21+
with:
22+
repository: neurostuff/${{ sdk[0] }}
23+
path: ${{ sdk[1] }}/${{ sdk[0] }}
24+
- name: Checkout reciprical branch
25+
run: |
26+
cd ${{ sdk[1] }}/${{ sdk[0] }}
27+
git checkout ${{ github.base_ref }} 2>/dev/null || git checkout -b ${{ github.base_ref }}
28+
- name: Generate SDK
29+
run: |
30+
./generate ${{ sdk[0] }}
31+
- name: Add and commit changes
32+
run: |
33+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
34+
git config --local user.name "github-actions[bot]"
35+
git commit -m "${{ github.sha }}" -a
36+
git push -q https://${{ secrets.SDK_PAT }}@github.com/neurostuff/${{ sdk[0] }}.git ${{ github.base_ref }}

generate.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
generate=$1
44

5-
if [ -z ${generate} ] || [ ${generate} == "python-neurostore" ]; then
5+
if [ -z ${generate} ] || [ ${generate} == "python-neurostore" || [ ${generate} == "neurostore-python-sdk" ]; then
66

77
echo "generating python-neurostore-sdk..."
88
docker run --rm --user $(id -u):$(id -g) \
@@ -13,7 +13,7 @@ if [ -z ${generate} ] || [ ${generate} == "python-neurostore" ]; then
1313
-o /local/python/neurostore-sdk
1414
fi
1515

16-
if [ -z ${generate} ] || [ ${generate} == "typescript-neurostore" ]; then
16+
if [ -z ${generate} ] || [ ${generate} == "typescript-neurostore" ] || [ ${generate} == "neurostore-typescript-sdk "]; then
1717

1818
echo "generating typescript-neurostore-sdk..."
1919
docker run --rm --user $(id -u):$(id -g) \
@@ -23,7 +23,7 @@ if [ -z ${generate} ] || [ ${generate} == "typescript-neurostore" ]; then
2323
-o /local/typescript/neurostore-sdk
2424
fi
2525

26-
if [ -z ${generate} ] || [ ${generate} == "python-neurosynth-compose" ]; then
26+
if [ -z ${generate} ] || [ ${generate} == "python-neurosynth-compose" ] || [ ${generate} == "neurosynth-compose-python-sdk "]; then
2727

2828
echo "generating python-neurosynth-compose-sdk..."
2929
docker run --rm --user $(id -u):$(id -g) \
@@ -34,7 +34,7 @@ if [ -z ${generate} ] || [ ${generate} == "python-neurosynth-compose" ]; then
3434
-o /local/python/neurosynth-compose-sdk
3535
fi
3636

37-
if [ -z ${generate} ] || [ ${generate} == "typescript-neurosynth-compose" ]; then
37+
if [ -z ${generate} ] || [ ${generate} == "typescript-neurosynth-compose" ] || [ ${generate} == "neurosynth-compose-typescript-sdk "]; then
3838

3939
echo "generating typescript-neurosynth-compose-sdk..."
4040
docker run --rm --user $(id -u):$(id -g) \

neurostore_python_sdk_config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"folder": "neurostore_sdk",
1010
"templateType": "SupportingFiles",
1111
"destinationFilename": "endpoint.py"
12+
},
13+
"github_actions.mustache": {
14+
"folder": ".github/workflows",
15+
"templateType": "SupportingFiles",
16+
"destinationFilename": "test.yml"
1217
}
1318
}
1419
}

neurosynth_compose_python_sdk_config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"folder": "neurosynth_compose_sdk",
1010
"templateType": "SupportingFiles",
1111
"destinationFilename": "endpoint.py"
12+
},
13+
"github_actions.mustache": {
14+
"folder": ".github/workflows",
15+
"templateType": "SupportingFiles",
16+
"destinationFilename": "test.yml"
1217
}
1318
}
1419
}

0 commit comments

Comments
 (0)