Skip to content

Commit

Permalink
Updated GH workflow and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomakehurst committed Jul 9, 2024
1 parent a25a0ab commit e36c490
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/generate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Generate SDKs
permissions:
checks: write
contents: write
pull-requests: write
statuses: write

on:
push:
branches: [ main ]

jobs:
generate:
name: Generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install APIMatic CLI
run: npm install -g @apimatic/cli

- name: Generate Typescript SDK
run: apimatic sdk:generate --destination=sdks/ts --platform TYPESCRIPT --file=openapi.yaml

- name: Set publishing coordiates
run: jq -r -s '.[0] * .[1]' package.json package-patch.json > tmp.json && mv -f tmp.json package.json

- name: Authenticate with private NPM package
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc

- name: Install project dependencies
run: npm ci

- name: Publish to GitHub Packages NPM
run: npm publish --scope=wiremock-inc --registry=https://npm.pkg.github.com


4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
sdks/**/**
sdks/**/**

.npmrc
31 changes: 31 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Login:

```
npm login --scope=wiremock-inc --auth-type=legacy --registry=https://npm.pkg.github.com
```

Init:

```
nvm use 20
npm i
```

Publish:

```
npm publish --scope=wiremock-inc --registry=https://npm.pkg.github.com
```

.npmrc:

```
@wiremock-inc:registry=https://npm.pkg.github.com
```

add to package.json:

```
"name": "@wiremock-inc/apimatic-sdkgen-demo",
"repository": "github:wiremock-inc/apimatic-sdkgen-demo",
```
4 changes: 2 additions & 2 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,8 @@ components:
description: OAuth 2.0 authorization code following RFC8725 best practices.
flows:
authorizationCode:
authorizationUrl: https://example.com/oauth/authorize
tokenUrl: https://example.com/oauth/token
authorizationUrl: https://google-sign-in.wiremockapi.cloud/o/oauth2/v2/auth
tokenUrl: https://google-sign-in.wiremockapi.cloud/token
scopes:
read: Read access
write: Write access
Expand Down

0 comments on commit e36c490

Please sign in to comment.