Skip to content

refactor(courses): added course links (#23) #139

refactor(courses): added course links (#23)

refactor(courses): added course links (#23) #139

Workflow file for this run

name: Publish API client derived from spec
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-ALPHA.[0-9]+'
permissions:
contents: read
packages: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: OpenAPI Generator Action
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: typescript-fetch
openapi-file: openapi.yaml
generator-tag: v7.4.0
# generates into <generator>-client
- id: get_version
uses: battila7/get-version-action@v2.2.1
- name: Generate package.json
env:
TAG_VERSION: ${{ steps.get_version.outputs.version-without-v }}
working-directory: ./typescript-fetch-client
run: |
cat <<EOF > package.json
{
"name": "@polito/api-client",
"version": "$TAG_VERSION",
"repository":"https://github.com/polito/api-spec"
}
EOF
cat package.json
echo -e "// @ts-nocheck\n$(cat runtime.ts)" > runtime.ts
# Fix for invalid type generated by GeoJSON spec reference
echo -e "// @ts-nocheck\n$(cat models/FeatureAllOfId.ts)" > models/FeatureAllOfId.ts
cat <<EOF > README.md
# PoliTO API Client
Autogenerated typescript-fetch client for the API of PoliTO, based on its [OpenAPI specification](https://github.com/polito/api-spec).
EOF
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
- run: npm publish
working-directory: ./typescript-fetch-client
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}