Publish #50
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: Publish | |
on: | |
release: | |
types: [released] | |
workflow_dispatch: | |
inputs: | |
skip_tests: | |
description: "Skip tests (force release)" | |
type: boolean | |
required: true | |
default: false | |
pub_sbt: | |
description: "Publish JARs" | |
type: boolean | |
required: true | |
default: true | |
pub_npm: | |
description: "Publish NPM (Latest Tag)" | |
type: boolean | |
required: true | |
default: false | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history/tags | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: "https://registry.npmjs.org" | |
- name: Build | |
run: sbt build | |
- name: Test | |
if: ${{ !inputs.skip_tests }} | |
run: sbt test | |
- name: Publish JARs | |
if: ${{ github.event_name == 'release' && github.event.action == 'released' || inputs.pub_sbt }} | |
run: sbt ci-release | |
env: | |
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | |
PGP_SECRET: ${{ secrets.OSSRH_GPG_SECRET_KEY_BASE64 }} | |
SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
# Only publishes full tagged releases to NPM | |
- name: Publish NPM | |
if: ${{ github.event_name == 'release' && github.event.action == 'released' || inputs.pub_npm }} | |
run: | | |
npm version --allow-same-version --no-git-tag-version from-git | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
working-directory: js/npm |