Build and update IGVF clients #34
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
name: Build and update IGVF clients | |
on: | |
workflow_dispatch: | |
jobs: | |
build-and-update-clients: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Generate a token | |
id: generate-token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.IGVF_CLIENT_BUILDER_APP_ID }} | |
private-key: ${{ secrets.IGVF_CLIENT_BUILDER_PRIVATE_KEY }} | |
owner: "IGVF-DACC" | |
repositories: "igvf-client-openapi-spec,igvf-python-client,igvf-async-python-client,igvf-r-client" | |
- name: Set git user identity | |
run: | | |
git config --global user.email "keenangraham@stanford.edu" | |
git config --global user.name "Keenan Graham" | |
- name: Generate OpenAPI specification | |
run: | | |
pip install -r requirements.txt | |
python generate.py | |
- name: Commit OpenAPI specification | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
OPENAPI_VERSION=$(jq -r '.info.version' ./openapi_spec.json) | |
gh auth setup-git | |
git checkout -b update-$OPENAPI_VERSION | |
git add openapi_spec.json | |
git commit -m "update-version-$OPENAPI_VERSION" | |
git push origin update-$OPENAPI_VERSION | |
git checkout main | |
git pull | |
git merge update-$OPENAPI_VERSION --ff-only | |
git push origin main | |
gh release create v$OPENAPI_VERSION -t "v$OPENAPI_VERSION" -n "Release version $OPENAPI_VERSION" | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install OpenAPI Generator CLI | |
run: | | |
npm install -g @openapitools/openapi-generator-cli@2.13.5 | |
- name: Build and update igvf-python-client | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
OPENAPI_VERSION=$(jq -r '.info.version' ./openapi_spec.json) | |
gh auth setup-git | |
git clone https://github.com/IGVF-DACC/igvf-python-client.git | |
cd igvf-python-client | |
git checkout -b update-$OPENAPI_VERSION | |
openapi-generator-cli generate -i ../openapi_spec.json -g python -t ./templates --additional-properties useOneOfDiscriminatorLookup=true,autosetConstants=true,packageName=igvf_client,packageVersion="$OPENAPI_VERSION" --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=Igvf --parameter-name-mappings field=include_fields --git-user-id="IGVF-DACC" --git-repo-id="igvf-python-client" | |
python ../scripts/reorder_readme.py | |
cp ../openapi_spec.json . | |
git add . | |
git commit -m "update-version-$OPENAPI_VERSION" | |
git push origin update-$OPENAPI_VERSION | |
git checkout main | |
git pull | |
git merge update-$OPENAPI_VERSION --ff-only | |
git push origin main | |
gh release create v$OPENAPI_VERSION -t "v$OPENAPI_VERSION" -n "Release version $OPENAPI_VERSION" | |
- name: Build and update igvf-async-python-client | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
OPENAPI_VERSION=$(jq -r '.info.version' ./openapi_spec.json) | |
gh auth setup-git | |
git clone https://github.com/IGVF-DACC/igvf-async-python-client.git | |
cd igvf-async-python-client | |
git checkout -b update-$OPENAPI_VERSION | |
openapi-generator-cli generate -i ../openapi_spec.json -g python -t ./templates --additional-properties library=asyncio,useOneOfDiscriminatorLookup=true,autosetConstants=true,packageName=igvf_async_client,packageVersion="$OPENAPI_VERSION" --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=AsyncIgvf --parameter-name-mappings field=include_fields --git-user-id="IGVF-DACC" --git-repo-id="igvf-async-python-client" | |
python ../scripts/reorder_readme.py | |
cp ../openapi_spec.json . | |
git add . | |
git commit -m "update-version-$OPENAPI_VERSION" | |
git push origin update-$OPENAPI_VERSION | |
git checkout main | |
git pull | |
git merge update-$OPENAPI_VERSION --ff-only | |
git push origin main | |
gh release create v$OPENAPI_VERSION -t "v$OPENAPI_VERSION" -n "Release version $OPENAPI_VERSION" | |
- name: Build and update igvf-r-client | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
OPENAPI_VERSION=$(jq -r '.info.version' ./openapi_spec.json) | |
gh auth setup-git | |
git clone https://github.com/IGVF-DACC/igvf-r-client.git | |
cd igvf-r-client | |
git checkout -b update-$OPENAPI_VERSION | |
openapi-generator-cli generate -i ../openapi_spec.json -g r -t ./templates --additional-properties useOneOfDiscriminatorLookup=true,autosetConstants=true,packageName=igvfclient,packageVersion="$OPENAPI_VERSION" --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=Igvf --parameter-name-mappings field=include_fields --git-host="github.com" --git-user-id="IGVF-DACC" --git-repo-id="igvf-r-client" | |
python ../scripts/reorder_readme.py | |
cp ../openapi_spec.json . | |
git add . | |
git commit -m "update-version-$OPENAPI_VERSION" | |
git push origin update-$OPENAPI_VERSION | |
git checkout main | |
git pull | |
git merge update-$OPENAPI_VERSION --ff-only | |
git push origin main | |
gh release create v$OPENAPI_VERSION -t "v$OPENAPI_VERSION" -n "Release version $OPENAPI_VERSION" |