-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (134 loc) · 5.16 KB
/
release-plugins.yml
File metadata and controls
140 lines (134 loc) · 5.16 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# 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: All Plugins Release
on:
workflow_dispatch:
inputs:
version:
description: The version of the release, if needed (x.y.z-p)
required: false
type: string
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' }}
version: ${{ inputs.next == true && 'patch' || 'minor' }}
runs-on: ubuntu-latest
strategy:
matrix:
browser: [chromium, chrome]
steps:
- uses: actions/checkout@v4
with:
repository: dont-code/plugins
path: plugins
fetch-depth: 0
ref: ${{ env.branch }}
token: ${{secrets.DONTCODE_ACTIONS_TOKEN}}
- name: Setup build environment
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: plugins/package-lock.json
- name: Install Nx.dev
run: npm install -g nx
- name: Version
if: ${{ ( matrix.browser == 'chromium' ) && ( inputs.version == '') }}
run: |
PACKAGE_VERSION=$(npm view @dontcode/plugin-basic versions --json | jq -r '.[-1]')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
cd libs/basic
npm version $PACKAGE_VERSION --allow-same-version
cd ../fields
npm version $PACKAGE_VERSION --allow-same-version
cd ../screen
npm version $PACKAGE_VERSION --allow-same-version
working-directory: 'plugins'
- name: Version ${{env.version}}
if: ${{ ( matrix.browser == 'chromium' ) && ( inputs.version == '') }}
run: |
cd libs/basic
npm version ${{env.version}}
cd ../fields
npm version ${{env.version}}
cd ../screen
npm version ${{env.version}}
working-directory: 'plugins'
- name: Version
if: ${{ ( matrix.browser == 'chromium' ) && ( inputs.version != '') }}
run: |
PACKAGE_VERSION=${{inputs.version}}
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
cd libs/basic
npm version $PACKAGE_VERSION
cd ../fields
npm version $PACKAGE_VERSION
cd ../screen
npm version $PACKAGE_VERSION
working-directory: 'plugins'
- name: Install ${{env.stage}}
run: |
npm ci
npm install @dontcode/core@${{env.stage}} --no-optional
working-directory: 'plugins'
- name: Build
run: |
nx run basic:build:production
nx run fields:build:production
nx run screen:build:production
working-directory: 'plugins'
- name: Unit tests
run: |
nx run screen:test
nx run basic:test
nx run fields:test
nx run plugin-tester:test
working-directory: 'plugins'
- run: |
nx run plugin-tester-e2e:e2e --browser ${{matrix.browser}}
working-directory: 'plugins'
- uses: actions/upload-artifact@v4
# Test run screenshots only on failure
if: failure()
with:
name: cypress-${{matrix.browser}}-screenshots
path: plugins/dist/cypress/apps/plugin-tester-e2e/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-${{matrix.browser}}-videos
path: plugins/dist/cypress/apps/plugin-tester-e2e/videos
- name: Deploy all plugins
run: nx run plugin-tester:build:production --output-path="dist/apps/plugin-tester/${{env.stage}}" --base-href "https://run.dont-code.net/plugins/${{env.stage}}/"
working-directory: 'plugins'
- if: ${{ success() && ( matrix.browser == 'chromium' ) && ( inputs.deploy == true) }}
uses: gcollin/ghaction-github-pages@main
with:
repo: dont-code/plugins
target_branch: gh-pages # The branch the action should deploy to.
build_dir: plugins/dist/apps/plugin-tester
keep_history: true
multiple_sites: true
jekyll: false
env:
GITHUB_TOKEN: ${{secrets.DONTCODE_ACTIONS_TOKEN }}
- name: Publish all libraries $${{env.stage}}
if: ${{ success() && ( matrix.browser == 'chromium' ) }}
run: |
npm publish plugins/dist/libs/basic --access public --tag ${{env.stage}}
npm publish plugins/dist/libs/fields --access public --tag ${{env.stage}}
npm publish plugins/dist/libs/screen --access public --tag ${{env.stage}}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}