Release npm package #112
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 npm package | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
pkg: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '23.x' | |
registry-url: https://registry.npmjs.org/ | |
- uses: coursier/cache-action@v6 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- uses: sbt/setup-sbt@v1 | |
- name: Build | |
run: | | |
sudo apt update -y | |
sudo apt install -y zlib1g php-zip tree | |
sbt scalafmtCheck stage createDistribution | |
sha512sum target/atom.zip > target/atom.zip.sha512 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.4.1' | |
bundler-cache: false | |
- name: Prepare 3.4.0 version | |
run: | | |
cd wrapper/nodejs | |
bash build.sh | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3.7' | |
bundler-cache: false | |
- name: Prepare 3.3.0 version | |
run: | | |
cd wrapper/nodejs | |
bash build.sh | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.6' | |
bundler-cache: false | |
- name: Prepare 3.2.0 version | |
run: | | |
cd wrapper/nodejs | |
bash build.sh | |
- name: Release tests | |
run: | | |
tree wrapper/nodejs/plugins | |
echo "appthreat:registry=https://registry.npmjs.org" > ~/.npmrc | |
npm publish --dry-run --@appthreat:registry='https://registry.npmjs.org' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPMJS_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish | |
run: | | |
npm config set //npm.pkg.github.com/:_authToken=$GITHUB_TOKEN | |
npm config set //registry.npmjs.org/:_authToken=$NPMJS_AUTH_TOKEN | |
echo "appthreat:registry=https://npm.pkg.github.com" > ~/.npmrc | |
npm publish --access=public --@appthreat:registry='https://npm.pkg.github.com' | |
echo "appthreat:registry=https://registry.npmjs.org" > ~/.npmrc | |
npm publish --provenance --access=public --@appthreat:registry='https://registry.npmjs.org' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPMJS_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
if: startsWith(github.ref, 'refs/tags/') |