diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 699dbe8..00fbc67 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -20,87 +20,94 @@ jobs: steps: - name: Checkout uses: DanySK/action-checkout@0.2.14 - - uses: actions/setup-node@v4 - if: matrix.os == 'windows-2022' - with: - node-version: 18 - cache: 'npm' - - uses: DanySK/build-check-deploy-gradle-action@2.4.8 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: -# Dry-deployment - check-command: ./gradlew build --parallel - deploy-command: >- - ./gradlew - uploadKotlinOSSRHToMavenCentralNexus - uploadPluginMavenToMavenCentralNexus - uploadPluginMarkerMavenToMavenCentralNexus - close - drop - --parallel - should-run-codecov: ${{ runner.os == 'Linux' }} - should-deploy: >- - ${{ - runner.os == 'Linux' - && !github.event.repository.fork - && github.event_name != 'pull_request' - }} - maven-central-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - signing-key: ${{ secrets.SIGNING_KEY }} - signing-password: ${{ secrets.SIGNING_PASSWORD }} - release: - permissions: - contents: write - packages: write - concurrency: - # Only one release job at a time. Strictly sequential. - group: release - needs: - - build - runs-on: ubuntu-22.04 - if: >- - !github.event.repository.fork - && github.event_name != 'pull_request' - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 -# with: -# token: ${{ secrets.DEPLOYMENT_TOKEN }} - - name: Find the version of Node from package.json - id: node-version - run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT - - name: Install Node + - name: setup node uses: actions/setup-node@v4.0.2 with: - node-version: ${{ steps.node-version.outputs.version }} + node-version: 18 + - name: Set up NPM for Windows + run: | + alias npm="npm.cmd" + npm --version - uses: DanySK/build-check-deploy-gradle-action@2.4.8 with: - build-command: true - check-command: true - deploy-command: | - npm install - npx semantic-release + build-command: ./gradlew build --parallel should-run-codecov: false - should-deploy: true - github-token: ${{ github.token }} - gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} - gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }} - maven-central-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} - maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - signing-key: ${{ secrets.SIGNING_KEY }} - signing-password: ${{ secrets.SIGNING_PASSWORD }} - success: - runs-on: ubuntu-22.04 - needs: - - release - - build - if: >- - always() && ( - contains(join(needs.*.result, ','), 'failure') - || !contains(join(needs.*.result, ','), 'cancelled') - ) - steps: - - name: Verify that there were no failures - run: ${{ !contains(join(needs.*.result, ','), 'failure') }} +# - uses: DanySK/build-check-deploy-gradle-action@2.4.8 +# env: +# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} +# with: +## Dry-deployment +# check-command: ./gradlew build --parallel +# deploy-command: >- +# ./gradlew +# uploadKotlinOSSRHToMavenCentralNexus +# uploadPluginMavenToMavenCentralNexus +# uploadPluginMarkerMavenToMavenCentralNexus +# close +# drop +# --parallel +# should-run-codecov: ${{ runner.os == 'Linux' }} +# should-deploy: >- +# ${{ +# runner.os == 'Linux' +# && !github.event.repository.fork +# && github.event_name != 'pull_request' +# }} +# maven-central-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} +# maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} +# signing-key: ${{ secrets.SIGNING_KEY }} +# signing-password: ${{ secrets.SIGNING_PASSWORD }} +# release: +# permissions: +# contents: write +# packages: write +# concurrency: +# # Only one release job at a time. Strictly sequential. +# group: release +# needs: +# - build +# runs-on: ubuntu-22.04 +# if: >- +# !github.event.repository.fork +# && github.event_name != 'pull_request' +# steps: +# - name: Checkout +# uses: actions/checkout@v4.1.1 +## with: +## token: ${{ secrets.DEPLOYMENT_TOKEN }} +# - name: Find the version of Node from package.json +# id: node-version +# run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT +# - name: Install Node +# uses: actions/setup-node@v4.0.2 +# with: +# node-version: ${{ steps.node-version.outputs.version }} +# - uses: DanySK/build-check-deploy-gradle-action@2.4.8 +# with: +# build-command: true +# check-command: true +# deploy-command: | +# npm install +# npx semantic-release +# should-run-codecov: false +# should-deploy: true +# github-token: ${{ github.token }} +# gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} +# gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }} +# maven-central-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }} +# maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} +# signing-key: ${{ secrets.SIGNING_KEY }} +# signing-password: ${{ secrets.SIGNING_PASSWORD }} +# success: +# runs-on: ubuntu-22.04 +# needs: +# - release +# - build +# if: >- +# always() && ( +# contains(join(needs.*.result, ','), 'failure') +# || !contains(join(needs.*.result, ','), 'cancelled') +# ) +# steps: +# - name: Verify that there were no failures +# run: ${{ !contains(join(needs.*.result, ','), 'failure') }} diff --git a/src/main/kotlin/io/github/zuccherosintattico/utils/NpmCommandsExtension.kt b/src/main/kotlin/io/github/zuccherosintattico/utils/NpmCommandsExtension.kt index 524cf25..c774267 100644 --- a/src/main/kotlin/io/github/zuccherosintattico/utils/NpmCommandsExtension.kt +++ b/src/main/kotlin/io/github/zuccherosintattico/utils/NpmCommandsExtension.kt @@ -7,6 +7,13 @@ import com.lordcodes.turtle.ShellScript */ object NpmCommandsExtension { + private val npmCommand: String = System.getProperty("os.name").let { os -> + when { + os.contains("Windows") -> "npm.cmd" + else -> "npm" + } + } + /** * Install the dependencies. */ @@ -15,7 +22,7 @@ object NpmCommandsExtension { /** * Run the NPM command. */ - fun ShellScript.npmCommand(vararg arguments: String): String = command("npm", arguments.toList()) + fun ShellScript.npmCommand(vararg arguments: String): String = command(npmCommand, arguments.toList()) /** * Run the NPX command.