Files
sample-node-api/.github/workflows/build_test.yml
2021-11-12 11:11:13 -05:00

93 lines
3.1 KiB
YAML

name: Build and Test Workflow
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
PERFORM_RELEASE:
description: '[Release] perform release'
required: false
default: '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:
user: ${{ github.actor }}
github-repo: ${{ github.repository }}
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 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_ARTIFACTORY_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }}
- name: '[Prep 4] Prepare workflow'
uses: zowe-actions/shared-actions/prepare-workflow@main
with:
github-user: ${{ secrets.ZOWE_ROBOT_USER }}
github-password: ${{ secrets.ZOWE_ROBOT_TOKEN }}
github-email: ${{ secrets.ZOWE_ROBOT_EMAIL }}
- name: '[Prep 5] Setup Node'
uses: actions/setup-node@v2
with:
node-version: 10.18.1
- name: '[Setup] NodeJS project setup'
uses: zowe-actions/nodejs-actions/setup@main
with:
package-name: 'org.zowe.sample-node-api'
- name: '[Build] Nodejs project build'
run: npm run build
- name: '[Packaging] Make pax'
uses: zowe-actions/shared-actions/make-pax@main
with:
pax-name: 'sample-node-api'
pax-ssh-username: ${{ secrets.SSH_MARIST_USERNAME }}
pax-ssh-password: ${{ secrets.SSH_MARIST_RACF_PASSWORD }}
- name: '[Publish] Publish'
uses: zowe-actions/shared-actions/publish@main
if: success()
with:
artifacts: .pax/sample-node-api.pax
perform-release: ${{ github.event.inputs.PERFORM_RELEASE }}
# Currently we don't have release for this project
# - 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