Skip to content

Merge pull request #276 from TokenScript/release/3.2.0 #530

Merge pull request #276 from TokenScript/release/3.2.0

Merge pull request #276 from TokenScript/release/3.2.0 #530

name: Build examples
#description: Build all examples
on:
push:
branches:
- main
- staging
pull_request:
branches:
- "*"
workflow_dispatch:
inputs:
negotiatorBranch:
description: "Use a specific branch from token-negotiator repo"
required: false
default: "none"
type: choice
options:
- "none"
- staging
- main
- patch
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Build
run: |
echo "Github base ref: $GITHUB_BASE_REF"
echo "Requested branch: $NEGOTIATOR_BRANCH"
npm install
if [[ $GITHUB_BASE_REF == "staging" ]]; then
echo "This is a staging branch PR, updating package.json files to use negotiator staging branch"
scripts/use_negotiator_branch.js staging
fi
if [[ ! -z $NEGOTIATOR_BRANCH && $NEGOTIATOR_BRANCH != "none" ]]; then
echo "Negotiator branch $NEGOTIATOR_BRANCH requested, updating package.json files"
scripts/use_negotiator_branch.js $NEGOTIATOR_BRANCH
fi
export BASE_PATH=/token-negotiator-examples/ecommerce-store-website
export MAX_PROCESSES=5
npm run install-examples
npm run clean
npm run build
npm run copy-artifacts
env:
NEGOTIATOR_BRANCH: ${{ inputs.negotiatorBranch }}
NODE_AUTH_TOKEN: ${{ github.token }}
GPR_KEY: ${{ secrets.GITHUB_TOKEN }}
sonarcloud:
needs:
- build
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}