Skip to content

Definitions Builder #86

Definitions Builder

Definitions Builder #86

name: Definitions Builder
on:
workflow_dispatch:
repository_dispatch:
types: [serverless-released]
jobs:
generateTSDefinitions:
name: Generate serverless/serverless typescript definitions
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm i
- name: Build plugin
run: npm run build
- id: serverless-version
name: Set Serverless latest version
run: echo "::set-output name=version::$(npm list serverless | grep serverless@ | sed 's/.*serverless@/v/g' | tr -d '[[:space:]]')"
- name: Generate definitions
run: npx sls schema
- name: Update package.json version
run: npm version ${{ steps.serverless-version.outputs.version }} --git-tag-version=false
- name: Commit changes
uses: EndBug/add-and-commit@v5
with:
author_name: Frédéric Barthelet
author_email: [email protected]
branch: master
message: Add Serverless definitions for ${{ steps.serverless-version.outputs.version }}
add: index.d.ts package.json
tag: ${{ steps.serverless-version.outputs.version }} --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}