V3 Upgrade #342
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
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: 18 | |
- 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 }} |