feat: only deploy to npm on user validation #9
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
id-token: write | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release-jvm: | |
name: Release JVM | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
JAVA_OPTS: "-Xmx4G" | |
SBT_OPTS: "-Dsbt.ci=true" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
- name: Prepare environment | |
env: | |
SONATYPE_SBT: ${{ secrets.SONATYPE_SBT }} | |
SONATYPE_PGP_SECRET: ${{ secrets.SONATYPE_PGP_SECRET }} | |
run: | | |
mkdir --parents ~/.sbt/1.0 || true | |
echo "$SONATYPE_SBT" > ~/.sbt/1.0/sonatype.sbt | |
echo -n "$SONATYPE_PGP_SECRET" | base64 --decode | gpg --batch --import | |
- name: Deploy Java adapter | |
id: deploy-jvm | |
env: | |
PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PASSPHRASE }} | |
working-directory: ./jvm | |
run: | | |
sbt "project gatling-jvm-to-js-adapter" "release with-defaults" | |
version="$(cat adapter/target/release-info)" | |
echo "version=$version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
release-js: | |
name: Release JS | |
needs: release-jvm | |
runs-on: ubuntu-latest | |
environment: | |
name: npm | |
url: https://www.npmjs.com/org/gatling.io | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Deploy JS packages | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
working-directory: ./js | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
npm ci | |
npm version "${{ steps.deploy-jvm.outputs.version }}" | |
npm run build --workspaces | |
for pkg in "cli" "jvm-types" "core" "http"; do | |
cp ../LICENSE "./$pkg/LICENSE" | |
npm publish "[email protected]/$pkg" | |
done |