Release 1.17.1 #42
Workflow file for this run
This file contains hidden or 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 npm Package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| registry: | |
| description: 'Registry to publish to' | |
| required: true | |
| default: 'github' | |
| type: choice | |
| options: | |
| - github | |
| - npmjs | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: temurin | |
| cache: sbt | |
| - name: Set up SBT | |
| uses: sbt/setup-sbt@v1 | |
| - name: Coursier Caching | |
| uses: coursier/cache-action@v6 | |
| - name: Configure sbt GitHub Packages credentials | |
| run: | | |
| mkdir -p ~/.sbt/1.0 | |
| cat > ~/.sbt/1.0/github.sbt << 'EOF' | |
| credentials += Credentials( | |
| "GitHub Package Registry", | |
| "maven.pkg.github.com", | |
| "x-access-token", | |
| sys.env.getOrElse("GITHUB_TOKEN", "") | |
| ) | |
| EOF | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Publish to GitHub Packages | |
| if: github.event_name == 'release' || github.event.inputs.registry == 'github' | |
| run: sbt --batch riddlLibJS/npmPublishGithub | |
| - name: Publish to npmjs.com | |
| if: github.event.inputs.registry == 'npmjs' | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: sbt --batch riddlLibJS/npmPublishNpmjs | |
| - name: Get version for summary | |
| id: version | |
| run: | | |
| VERSION=$(sbt --batch "print riddlLibJS/version" 2>/dev/null | grep -v "\[info\]" | grep -v "loading" | tail -1 | tr -d ' ') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Generate summary | |
| run: | | |
| echo "## npm Package Published" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Package:** \`@ossuminc/riddl-lib\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Installation" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY | |
| echo "npm install @ossuminc/riddl-lib" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY |