Skip to content

Merge pull request #41 from notificationapi-com/nextExamples #36

Merge pull request #41 from notificationapi-com/nextExamples

Merge pull request #41 from notificationapi-com/nextExamples #36

Workflow file for this run

on:
push:
branches:
- master
name: pipeline
jobs:
Release:
name: Test & Build & Punlish
runs-on: ubuntu-latest
outputs:
releaseType: ${{ steps.publish.outputs.type }}
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.17
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 18.17.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: NPM Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Lint
run: npm run-script lint
- name: Pretty
run: npm run-script prettier-check
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,action,took
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always() # Pick up events even if the job fails or is canceled.
- name: Publish
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.JS_CLIENT_SDK_NPM_AUTH_TOKEN }}
- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo
text: Published to NPM ${{ steps.publish.outputs.old-version }} -> ${{ steps.publish.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: steps.publish.outputs.type != 'none' && always()
DeployExamplesLive:
name: DeployExamplesLive
needs: Release
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
example:
[
reactjs-live,
reactts-live,
vanillajs-live,
vitereactts-live,
nextts-live
]
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.17
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 18.17.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: NPM Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Build
run: npm run build
- name: Install example dependencies
if: ${{matrix.example != 'vanillajs-live'}}
working-directory: examples/${{matrix.example}}
run: npm install
- name: Deploy example
working-directory: examples/${{matrix.example}}
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Cypress:
name: Cypress
needs: DeployExamplesLive
runs-on: ubuntu-latest
container: cypress/browsers:node12.18.3-chrome87-ff82
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v4
with:
browser: chrome
record: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
CYPRESS_TESTING_MODE: 'LIVE'