Publish NPM Github Package store #8
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Publish NPM Github Package store | |
on: | |
push: | |
#On versioned releases | |
tags: | |
- v*.*.* | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
force: | |
type: choice | |
description: Retry Publish Version | |
options: | |
- No | |
- Yes | |
jobs: | |
build: | |
env: | |
#When run on push tags, force is '', default for workflow_dispatch is No so you can't trigger without a double action | |
DO_DEPLOYMENT: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.force == 'Yes' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
strategy: | |
matrix: | |
jdk: [ '21' ] | |
name: Publish Package to GPR | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.jdk }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '${{ matrix.jdk }}' | |
- name: Cache Maven packages | |
id: cache-maven | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
# save-always: true | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }} | |
- name: Get Versions | |
run: | | |
echo "Google chrome version" | |
google-chrome --version | |
echo "firefox version" | |
firefox --version | |
echo "temp folder: ${{ runner.temp }}" | |
- name: Build with Maven | |
run: mvn --batch-mode --update-snapshots deploy -Djava.io.tmpdir=${{ runner.temp }} | |
if: ${{ env.DO_DEPLOYMENT == 'true' }} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
NVD_NIST_APIKEY: ${{ secrets.NVD_NIST_APIKEY}} | |
- name: Publish - Skipped | |
if: ${{ env.DO_DEPLOYMENT != 'true' }} | |
run: | | |
echo "### Publish skipped" >> $GITHUB_STEP_SUMMARY | |
echo "DO_DEPLOYMENT( ${{ env.DO_DEPLOYMENT }} ): github.event_name: ${{ github.event_name != 'workflow_dispatch'}} || github.event.inputs.force: ${{ github.event.inputs.force == 'Yes' }}" >> $GITHUB_STEP_SUMMARY | |