Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: release new package for bundled openapi yaml file #6

Merged
merged 4 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish d.ts package to npmjs
name: Release npm packages
on:
push:
branches:
Expand All @@ -20,9 +20,23 @@ jobs:
- run: echo 'NPM install & build...'
- run: npm ci
- run: npm run build
- run: cp ./openapi/base.package.json ./dist/dts/package.json
- run: echo "__OAS_VERSION=`/usr/bin/yq e '.info.version' openapi/openapi.yaml`" >> "$GITHUB_ENV"
- name: Create package.json
- run: cp ./openapi/base.package.json ./dist/yaml/package.json
- name: Create package.json for yaml package...
env:
__PACKAGE_NAME: '@plugoinc/ocpi-openapi-yaml'
__MAIN_FILE: 'openapi.yaml'
working-directory: ./dist/yaml
run: |
cat ./package.json | jq --arg NAME $__PACKAGE_NAME '.name = $NAME' > ./package.json.tmp
mv ./package.json.tmp ./package.json
cat ./package.json | jq --arg VERSION $__OAS_VERSION '.version = $VERSION' > ./package.json.tmp
mv ./package.json.tmp ./package.json
cat ./package.json | jq --arg MAIN $__MAIN_FILE '.main = $MAIN' > ./package.json.tmp
mv ./package.json.tmp ./package.json
cat ./package.json
- run: cp ./openapi/base.package.json ./dist/dts/package.json
- name: Create package.json for dts package...
env:
__PACKAGE_NAME: '@plugoinc/ocpi-openapi-dts'
__MAIN_FILE: 'schema.d.ts'
Expand All @@ -35,8 +49,13 @@ jobs:
cat ./package.json | jq --arg MAIN $__MAIN_FILE '.main = $MAIN' > ./package.json.tmp
mv ./package.json.tmp ./package.json
cat ./package.json
- run: echo 'Publish to npmjs...'
- run: npm publish -access public
- name: Publish yaml package to npmjs...
run: npm publish -access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./dist/yaml
- name: Publish dts package to npmjs...
run: npm publish -access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./dist/dts
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"scripts": {
"start": "openapi preview-docs",
"build": "npm run clean && npm run build:yaml && npm run build:dts",
"build:yaml": "openapi bundle -o dist/yaml/dist.yaml",
"build:dts": "openapi-typescript dist/yaml/dist.yaml -o dist/dts/schema.d.ts",
"build:yaml": "openapi bundle -o dist/yaml/openapi.yaml",
"build:dts": "openapi-typescript dist/yaml/openapi.yaml -o dist/dts/schema.d.ts",
"clean": "rm -rf dist || true",
"test": "openapi lint"
},
Expand Down