Skip to content

Commit

Permalink
init sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Feb 25, 2024
1 parent 0923a7d commit 8ed4d3e
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
60 changes: 60 additions & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: builder

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
sdk:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate SDK
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: javascript
openapi-url: https://raw.githubusercontent.com/bavix/gripmock-openapi/master/api.yaml
command-args: -o . --package-name gripmock-sdk-js -c config.yaml

- name: "Check if build has changed"
if: success()
id: has-changes
run: |
echo "stdout<<EOF" >> $GITHUB_OUTPUT
echo "$(git diff --stat)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: "git add --all"
run: git add --all

- name: Import GPG key
if: ${{ steps.has-changes.outputs.stdout }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_BOT }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
fingerprint: ${{ secrets.GPG_FINGERPRINT }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: Github bot
git_committer_email: [email protected]

- name: "Commit files"
if: ${{ steps.has-changes.outputs.stdout }}
env:
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
git commit -S -m "sdk generated" -a
- name: "Push changes"
if: ${{ steps.has-changes.outputs.stdout }}
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: git push -u origin HEAD
14 changes: 14 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: update changelog

on:
release:
types: [released]

permissions: {}

jobs:
changelog:
permissions:
contents: write
secrets: inherit
uses: bavix/.github/.github/workflows/[email protected]
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish package to GitHub Packages
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '21.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@bavix'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
Expand Down Expand Up @@ -128,3 +127,5 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.idea/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gen-client:
# https://github.com/OpenAPITools/openapi-generator
openapi-generator generate -i https://raw.githubusercontent.com/bavix/gripmock-openapi/master/api.yaml -g javascript -o ./generated/
4 changes: 4 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
additionalProperties:
projectName: gripmock-sdk-js
projectVersion: 2.4.0
licenseName: MIT
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "gripmock-sdk-js",
"version": "2.4.0",
"type": "module",
"description": "GripMock SDK.",
"private": true,
"repository": {
"type": "git",
"url": "github.com/bavix/gripmock-sdk-js"
},
"keywords": [
"gripmock",
"sdk"
],
"author": "Maksim Babichev",
"license": "MIT"
}

0 comments on commit 8ed4d3e

Please sign in to comment.