Preview-Ui Release #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Preview-Ui Release | |
on: | |
workflow_dispatch: | |
inputs: | |
next: | |
description: Is it a dev / next release ? | |
required: true | |
type: boolean | |
deploy: | |
description: Deploy to public website? | |
required: true | |
type: boolean | |
jobs: | |
build: | |
env: | |
branch: ${{ inputs.next == true && 'Development' || 'main' }} | |
stage: ${{ inputs.next == true && 'next' || 'latest' }} | |
build: ${{ inputs.next == true && 'next' || 'production' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
browser: [chromium, chrome, firefox] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{env.branch}} | |
token: ${{secrets.DONTCODE_ACTIONS_TOKEN}} | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
- name: Install Nx.dev | |
run: | | |
npm install -g nx | |
- name: Install ${{env.stage}} | |
run: | | |
npm install @dontcode/core@${{env.stage}} @dontcode/plugin-common@${{env.stage}} @dontcode/sandbox@${{env.stage}} | |
npm install | |
- name: Build | |
run: | | |
nx run preview-ui:build:production | |
- name: Unit tests | |
run: | | |
nx run preview-ui:test | |
- name: E2E Tests on ${{matrix.browser}} | |
run: | | |
nx run preview-ui-e2e:e2e --browser ${{matrix.browser}} | |
- uses: actions/upload-artifact@v3 | |
# Test run screenshots only on failure | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: dist/cypress/apps/preview-ui-e2e/screenshots | |
# Test run video was always captured, so this action uses "always()" condition | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-videos | |
path: dist/cypress/apps/preview-ui-e2e/videos | |
- name: Deploy the tester application in github pages | |
if: ${{ success() && matrix.browser == 'chromium' && ( inputs.deploy == true ) }} | |
run: | | |
nx run preview-ui:build:${{env.build}} --output-path="dist/apps/preview-ui/${{env.stage}}" --base-href "https://dont-code.net/preview-ui/${{env.stage}}/" | |
- if: ${{ success() && (matrix.browser == 'chromium') &&( inputs.deploy == true ) }} | |
uses: gcollin/ghaction-github-pages@main | |
with: | |
repo: dont-code/preview-ui | |
target_branch: gh-pages # The branch the action should deploy to. | |
build_dir: dist/apps/preview-ui | |
keep_history: true | |
multiple_sites: true | |
jekyll: false | |
env: | |
GITHUB_TOKEN: ${{secrets.DONTCODE_ACTIONS_TOKEN }} |