Skip to content

Commit

Permalink
Merge pull request #3 from plugoinc/feature/ci-release-dts
Browse files Browse the repository at this point in the history
feat: add CI to generate dts files
  • Loading branch information
Ko1103 authored Aug 4, 2023
2 parents 24fd11f + 1086987 commit 03b6db6
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish d.ts package to npmjs
on:
push:
branches:
- main

jobs:
publish-dts:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: echo 'Install yq...'
- run: curl -LJO https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
- run: sudo mv yq_linux_amd64 /usr/local/bin/yq
- run: sudo chmod a+x /usr/local/bin/yq
- 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
env:
__PACKAGE_NAME: '@plugoinc/ocpi-openapi-dts'
__MAIN_FILE: 'schema.d.ts'
working-directory: ./dist/dts
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: echo 'Publish to npmjs...'
- run: npm publish -access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./dist/dts
16 changes: 16 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Test Package
on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm ci
- run: npm run test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Dir for bundles
dist
node_modules

# OS
.DS_Store
12 changes: 12 additions & 0 deletions openapi/base.package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@plugoinic/ocpi-openapi",
"version": "0.0.1",
"description": "OpenAPI 3.1.0 schema for OCPI 2.2.1",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"main": "",
"keywords": ["ocpi", "openapi", "schema", "plugo"],
"author": "plugo <dev@plugo.co.jp>",
"license": "MIT"
}
8 changes: 4 additions & 4 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
openapi: 3.1.0
info:
version: 2.2.1
version: 0.0.2
title: OCPI

contact:
email: thaddeusjiang@gmail.com
url: https://thaddeusjiang.com
email: dev@plugo.co.jp
url: https://plugo.co.jp/
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
Expand Down Expand Up @@ -73,4 +73,4 @@ components:
name: api_key
basic_auth:
type: http
scheme: basic
scheme: basic

0 comments on commit 03b6db6

Please sign in to comment.