-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from plugoinc/feature/ci-release-dts
feat: add CI to generate dts files
- Loading branch information
Showing
5 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Dir for bundles | ||
dist | ||
node_modules | ||
|
||
# OS | ||
.DS_Store |
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
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" | ||
} |
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