Skip to content

Php/include resource owner password authenticator #300

Php/include resource owner password authenticator

Php/include resource owner password authenticator #300

Workflow file for this run

name: vaas-typescript-ci
on:
push:
branches:
- main
paths:
- "typescript/**"
- ".github/workflows/ci-typescript.yaml"
tags:
- "ts*"
pull_request:
branches:
- main
paths:
- "typescript/**"
- ".github/workflows/ci-typescript.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/ts')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/ts')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/ts')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}
VAAS_CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
VAAS_USER_NAME: ${{ secrets.VAAS_USER_NAME }}
VAAS_PASSWORD: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/php')) && secrets.VAAS_PASSWORD || secrets.STAGING_VAAS_PASSWORD }}
jobs:
build-typescript:
name: Build & Test TypeScript SDK
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
name: install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- uses: actions/setup-node@v3
name: setup node
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
cache-dependency-path: "typescript/pnpm-lock.yaml"
- name: install dependencies
run: pnpm install --frozen-lockfile
working-directory: typescript
- name: build
run: pnpm run build
working-directory: typescript
- name: run tests
run: pnpm run test
working-directory: typescript
- name: install dependencies for example
run: pnpm install
working-directory: typescript/examples/VaasExample
- name: run examples scan file
env:
SCAN_PATH: "main.ts"
run: npx ts-node main.ts
working-directory: typescript/examples/VaasExample
- name: run examples scan url
run: npx ts-node url_scan.ts
working-directory: typescript/examples/VaasExample
- name: extract version
if: startsWith(github.ref, 'refs/tags/ts')
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/ts}" >> $GITHUB_ENV
echo $RELEASE_VERSION
- name: set version
if: startsWith(github.ref, 'refs/tags/ts')
run: |
sed -i "s/\"version\": \"0.0.0\"/\"version\": \"$RELEASE_VERSION\"/g" ./typescript/package.json
- name: publish npm package
if: startsWith(github.ref, 'refs/tags/ts')
run: npm publish
working-directory: typescript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Microsoft Teams Notification
uses: skitionek/notify-microsoft-teams@master
if: failure()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
overwrite: "{title: `Failed workflow on for VaaS-SDK ${workflow}`, sections: [{activityTitle: 'build failed', activitySubtitle: `Failed workflow on for VaaS-SDK ${workflow}`, activityImage: 'https://adaptivecards.io/content/cats/3.png'}], themeColor: '#ff0000'}"