-
Notifications
You must be signed in to change notification settings - Fork 17
120 lines (106 loc) · 4.78 KB
/
build_test.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
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
name: Build and Test Workflow
on:
push:
branches:
- v2.x/staging
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
ZLUX_CORE_ARTIFACTORY_PATTERN:
description: ZLUX Core artifactory download pattern
required: false
default: 'libs-snapshot-local/org/zowe/zlux/zlux-core/*-V2.X-STAGING-ZLUX-CORE/zlux-core-*.tar'
PERFORM_RELEASE:
description: 'perform release'
required: false
default: false
type: boolean
PRE_RELEASE_STRING:
description: 'Pre-release string for a release. For example: rc.1, beta.1, etc. This is required if the release is not performed on branches which "allowFormalRelease" is true.'
required: false
jobs:
check-permission:
runs-on: ubuntu-latest
steps:
# this action will fail the whole workflow if permission check fails
- name: check permission
uses: zowe-actions/shared-actions/permission-check@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
build-test:
runs-on: ubuntu-latest
needs: check-permission
steps:
- name: '[Prep 1] Checkout'
uses: actions/checkout@v2
- name: '[Prep 1] Validate package.json'
uses: zowe-actions/shared-actions/validate-package-json@main
- name: '[Prep 2] Cache node modules'
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: |
~/.npm
~/.nvm/.cache
~/.nvm/versions
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-node-modules-
- name: '[Prep 3] Setup jFrog CLI'
uses: jfrog/setup-jfrog-cli@v2
env:
JF_ENV_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }}
- name: '[Prep 4] Prepare workflow'
uses: zowe-actions/shared-actions/prepare-workflow@main
- name: '[Prep 5] Setup Node'
uses: actions/setup-node@v2
with:
node-version: 14
- name: '[Setup] NodeJS project setup'
uses: zowe-actions/nodejs-actions/setup@main
with:
package-name: 'org.zowe.zlux-angular-file-tree'
install-registry-url: ${{ env.DEFAULT_NPM_PRIVATE_INSTALL_REGISTRY }}
install-registry-email: ${{ secrets.NPM_PRIVATE_REGISTRY_EMAIL }}
install-registry-username: ${{ secrets.NPM_PRIVATE_REGISTRY_USERNAME }}
install-registry-password: ${{ secrets.NPM_PRIVATE_REGISTRY_PASSWORD }}
publish-registry-email: ${{ secrets.NPM_PRIVATE_REGISTRY_EMAIL }}
publish-registry-username: ${{ secrets.NPM_PRIVATE_REGISTRY_USERNAME }}
publish-registry-password: ${{ secrets.NPM_PRIVATE_REGISTRY_PASSWORD }}
- name: '[Build 1] Prepare zlux Dependencies'
run: |
if [ -z "${{ github.event.inputs.ZLUX_CORE_ARTIFACTORY_PATTERN }}" ];
then
export ZLUX_CORE_ARTIFACTORY_PATTERN="libs-snapshot-local/org/zowe/zlux/zlux-core/*-V2.X-STAGING-ZLUX-CORE/zlux-core-*.tar"
else
export ZLUX_CORE_ARTIFACTORY_PATTERN="${{ github.event.inputs.ZLUX_CORE_ARTIFACTORY_PATTERN }}"
fi
jfrog rt dl --sort-by=created --sort-order=desc --limit=1 --flat=true $ZLUX_CORE_ARTIFACTORY_PATTERN zlux/
cd zlux
tar xvf zlux-core-*.tar
- name: '[Build 2] Nodejs project build'
run: |
export MVD_DESKTOP_DIR=zlux/zlux-app-manager/virtual-desktop
npm run build
# note: this step is not actually doing upload to artifactory because no artifact input is provided.
# this is just to parse and create a PUBLISH_VERSION then export, later NPM publish step can use.
- name: '[Publish 1] Publish'
uses: zowe-actions/shared-actions/publish@main
if: success()
with:
perform-release: ${{ github.event.inputs.PERFORM_RELEASE }}
pre-release-string: ${{ github.event.inputs.PRE_RELEASE_STRING }}
- name: '[Publish 2] NPM Publish'
if: success()
uses: zowe-actions/nodejs-actions/publish@main
with:
perform-release: ${{ github.event.inputs.PERFORM_RELEASE }}
- name: '[Release 1] Release (if necessary)'
if: ${{ success() && github.event.inputs.PERFORM_RELEASE == 'true' && env.IS_RELEASE_BRANCH == 'true' }}
uses: zowe-actions/shared-actions/release@main
- name: '[Release 2] NPM bump version (if necessary)'
if: ${{ success() && github.event.inputs.PERFORM_RELEASE == 'true' && env.IS_RELEASE_BRANCH == 'true' && env.IS_FORMAL_RELEASE_BRANCH == 'true' && env.PRE_RELEASE_STRING == ''}}
uses: zowe-actions/nodejs-actions/bump-version@main
env:
GITHUB_TOKEN: ${{ secrets.ZOWE_ROBOT_TOKEN }}