Merge pull request #2 from osu-tournament-rating/feature/otr-api-mast… #9
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: Client Code Generation | |
on: | |
push: | |
branches: [ 'master' ] | |
paths: | |
- 'swagger.json' | |
- 'nswag.json' | |
- '**.liquid' | |
env: | |
TS_CLIENT_CHANGED: false | |
jobs: | |
generate_client: | |
name: Generate Client Code | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0.x' | |
- name: Setup NSwag CLI | |
run: dotnet tool install --global Nswag.ConsoleCore | |
- name: Generate Clients | |
run: nswag run | |
- name: Detect TS Client Code Change | |
run: | | |
git diff -s --exit-code ${{ github.workspace }}/${{ vars.TS_CLIENT_PATH }}/index.ts || echo "TS_CLIENT_CHANGED=true" >> $GITHUB_ENV | |
- name: Navigate to TS Client | |
if: env.TS_CLIENT_CHANGED | |
run: cd ${{ github.workspace }}/${{ vars.TS_CLIENT_PATH }} | |
- name: Setup node | |
if: env.TS_CLIENT_CHANGED | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Bump TS Client Package Version | |
if: env.TS_CLIENT_CHANGED | |
run: npm version patch | |
- name: Navigate to Repository Root | |
run: cd ${{ github.workspace }} | |
- name: Commit Changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Automated client code generation |