-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (79 loc) · 2.99 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{env.branch}}
token: ${{secrets.DONTCODE_ACTIONS_TOKEN}}
- name: Use Node.js 18
uses: actions/setup-node@v4
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 ci
npm install @dontcode/core@${{env.stage}} @dontcode/plugin-common@${{env.stage}} @dontcode/sandbox@${{env.stage}}
- 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@v4
# Test run screenshots only on failure
if: failure()
with:
name: cypress-${{matrix.browser}}-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@v4
if: always()
with:
name: cypress-${{matrix.browser}}-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://run.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 }}