Reduce the number of gradle versions we check (#5436) #1903
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: Publish a release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
concurrency: | |
group: "release" | |
cancel-in-progress: false | |
jobs: | |
publish_archives: | |
strategy: | |
matrix: | |
os: [macOS-14, windows-latest, ubuntu-latest] | |
runs-on: ${{matrix.os}} | |
if: github.repository == 'cashapp/sqldelight' | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version-file: .github/workflows/.ci-java-version | |
- name: Setup gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Publish the macOS artifacts | |
if: matrix.os == 'macOS-14' | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | |
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-parallel | |
- name: Publish the windows artifact | |
if: matrix.os == 'windows-latest' | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | |
run: ./gradlew publishMingwX64PublicationToMavenCentralRepository --no-parallel | |
- name: Publish the linux artifact | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | |
run: ./gradlew publishLinuxX64PublicationToMavenCentralRepository --no-parallel | |
publish_plugin: | |
runs-on: ubuntu-latest | |
if: github.repository == 'cashapp/sqldelight' | |
permissions: | |
contents: read | |
needs: publish_archives | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
# https://github.com/gradle/gradle-build-action/issues/561 | |
- name: Create Gradle files | |
run: | | |
cd ~ | |
mkdir -p .gradle/ && touch .gradle/gradle.properties | |
- name: Set up Java | |
id: setup-java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version-file: .github/workflows/.ci-java-version | |
- name: Setup Gradle Java installations paths | |
run: | | |
cd ~/.gradle | |
echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties | |
- name: Setup gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Publish the plugin artifacts | |
env: | |
ORG_GRADLE_PROJECT_SQLDELIGHT_BUGSNAG_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SQLDELIGHT_BUGSNAG_KEY }} | |
ORG_GRADLE_PROJECT_intellijPublishToken: ${{ secrets.ORG_GRADLE_PROJECT_intellijPublishToken }} | |
run: ./gradlew publishPlugin --stacktrace --no-parallel | |
publish_npm_packages: | |
runs-on: ubuntu-latest | |
if: github.repository == 'cashapp/sqldelight' | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
# https://github.com/gradle/gradle-build-action/issues/561 | |
- name: Create Gradle files | |
run: | | |
cd ~ | |
mkdir -p .gradle/ && touch .gradle/gradle.properties | |
- name: Set up Java | |
id: setup-java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version-file: .github/workflows/.ci-java-version | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Setup Gradle Java installations paths | |
run: | | |
cd ~/.gradle | |
echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties | |
- name: Setup gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Setup .npmrc | |
run: echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc | |
- name: Get Version | |
run: cat gradle.properties | grep --color=never VERSION_NAME >> $GITHUB_OUTPUT | |
id: version | |
- name: Assemble NPM Packages | |
run: ./gradlew :drivers:web-worker-driver:sqljs:assemblePackage | |
- name: Publish SNAPSHOT Packages | |
working-directory: drivers/web-worker-driver/sqljs/build/package | |
if: ${{ success() && contains(steps.version.outputs.VERSION_NAME, 'SNAPSHOT') }} | |
run: npm publish --tag snapshot | |
- name: Publish Packages | |
working-directory: drivers/web-worker-driver/sqljs/build/package | |
if: ${{ success() && !contains(steps.version.outputs.VERSION_NAME , 'SNAPSHOT') }} | |
run: npm publish | |
env: | |
GRADLE_OPTS: -Dorg.gradle.caching=true | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |