Merge pull request #259 from HCL-TECH-SOFTWARE/task/MXOP-21208-resolv… #251
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: Push Snapshot to Github registry | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
name: Deploy Snapshot to ghcr.io | |
runs-on: ubuntu-latest | |
env: | |
REACT_APP_ADMIN_UI_BUILD_VERSION: ${{ github.run_number }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 8 | |
distribution: 'temurin' | |
- name: Extract Project version | |
id: project | |
run: echo "MVN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: set productName for Snapshot | |
if: endsWith(env.MVN_VERSION, '-SNAPSHOT') | |
run: echo "PRODUCT_NAME=HCL Labs Project KEEP" >> $GITHUB_ENV | |
- name: Determine productName for release | |
if: ${{ ! endsWith(env.MVN_VERSION, '-SNAPSHOT')}} | |
run: echo "PRODUCT_NAME=HCL Labs Project KEEP $MVN_VERSION" >> $GITHUB_ENV | |
- name: Check env variables | |
run: echo version = $MVN_VERSION, product = $PRODUCT_NAME | |
- run: mvn --no-transfer-progress clean | |
- run: npm ci | |
- run: npm run build | |
- run: npm run test | |
- name: Set Mend Product name | |
run: echo "WS_PRODUCTNAME=${{ env.PRODUCT_NAME }}" >> $GITHUB_ENV | |
- name: Run Mend Scan | |
uses: TheAxZim/Whitesource-Scan-Action@v1.0.0 | |
with: | |
wssURL: https://saas.whitesourcesoftware.com/agent | |
apiKey: ${{ secrets.WSS_API_KEY }} | |
configFile: 'admin-wss.config' | |
- name: Publish only Snapshot to GitHub Packages | |
if: endsWith(env.MVN_VERSION, '-SNAPSHOT') | |
run: mvn --no-transfer-progress deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |