Skip to content

Commit

Permalink
fix(ci): windows stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
manuandru committed Mar 15, 2024
1 parent 1fdcc52 commit f03c2ca
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 80 deletions.
165 changes: 86 additions & 79 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
Expand Down

0 comments on commit f03c2ca

Please sign in to comment.