Merge pull request #46 from zowe/users/mergev3master #93
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 | |
permissions: | |
id-token: write | |
issues: write | |
pull-requests: write | |
contents: write | |
on: | |
push: | |
branches: | |
- v3.x/master | |
pull_request: | |
types: [opened, synchronize] | |
workflow_dispatch: | |
inputs: | |
PERFORM_RELEASE: | |
description: '[Release] perform release' | |
required: false | |
default: 'false' | |
type: boolean | |
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 }} | |
validate-package-json: | |
needs: check-permission | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Validate package.json | |
uses: zowe-actions/shared-actions/validate-package-json@main | |
build-test: | |
runs-on: ubuntu-latest | |
needs: validate-package-json | |
steps: | |
- name: '[Prep 1] Checkout' | |
uses: actions/checkout@v2 | |
- 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: 16.15.0 | |
- name: '[Setup] NodeJS project setup' | |
uses: zowe-actions/nodejs-actions/setup@main | |
with: | |
package-name: 'org.zowe.explorer-fvt-utilities' | |
publish-registry-email: ${{ secrets.ZOWE_ROBOT_EMAIL }} | |
publish-registry-username: ${{ secrets.ARTIFACTORY_USERNAME }} | |
publish-registry-password: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
- name: '[Build] Nodejs project build' | |
run: 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] Regular project publish' | |
uses: zowe-actions/shared-actions/publish@main | |
with: | |
perform-release: ${{ github.event.inputs.PERFORM_RELEASE }} | |
- 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 }} |