Refactor Gradle workflows
Uses the actions found in the Kotlin mpp template gallery[1]. [1] https://kmp.jetbrains.com/#templateGallery
This commit is contained in:
parent
d3d0381d2c
commit
402999a1da
56
.github/workflows/build.yaml
vendored
Normal file
56
.github/workflows/build.yaml
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master" ]
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: build
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: iosX64Test
|
||||||
|
os: macos-latest
|
||||||
|
- target: macosX64Test
|
||||||
|
os: macos-latest
|
||||||
|
- target: tvosX64Test
|
||||||
|
os: macos-latest
|
||||||
|
- target: watchosX64Test
|
||||||
|
os: macos-latest
|
||||||
|
- target: mingwX64Test
|
||||||
|
os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Validate Gradle Wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.konan
|
||||||
|
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
|
||||||
|
|
||||||
|
- name: Setup JDK
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 8
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v3
|
||||||
|
|
||||||
|
- name: Build with Gradle Wrapper
|
||||||
|
run: ./gradlew ${{ matrix.target }}
|
139
.github/workflows/ci.yaml
vendored
139
.github/workflows/ci.yaml
vendored
@ -1,139 +0,0 @@
|
|||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "master" ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "master" ]
|
|
||||||
workflow_call:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ ubuntu-latest, macos-11, windows-latest ]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.konan
|
|
||||||
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('buildSrc/src/main/kotlin/Versions.kt') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-konan-
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/wrapper
|
|
||||||
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gradle-wrapper-
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/caches
|
|
||||||
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('buildSrc/src/main/kotlin/Versions.kt') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gradle-caches-
|
|
||||||
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 1.8
|
|
||||||
|
|
||||||
- run: ./gradlew linuxX64Test
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
|
|
||||||
- run: ./gradlew mingwX64Test
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
|
|
||||||
- run: ./gradlew build
|
|
||||||
if: matrix.os == 'macos-11'
|
|
||||||
|
|
||||||
publish:
|
|
||||||
needs: build
|
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && needs.build.result == 'success'
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ ubuntu-latest, macos-11, windows-latest ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
|
|
||||||
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
|
|
||||||
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
|
|
||||||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
|
||||||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.konan
|
|
||||||
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('buildSrc/src/main/kotlin/Versions.kt') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-konan-
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/wrapper
|
|
||||||
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gradle-wrapper-
|
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.gradle/caches
|
|
||||||
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('buildSrc/src/main/kotlin/Versions.kt') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gradle-caches-
|
|
||||||
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 1.8
|
|
||||||
|
|
||||||
# ./gradlew tasks | grep "PublicationToMavenRepository" | grep -e "publishAndroid" -e "publishJs" -e "publishJvm" -e "publishKotlinMultiplatform" -e "publishLinux" -e "publishWasm" | cut -d ' ' -f 1
|
|
||||||
- if: matrix.os == 'ubuntu-latest'
|
|
||||||
run: >
|
|
||||||
./gradlew
|
|
||||||
publishAndroidNativeArm32PublicationToMavenRepository
|
|
||||||
publishAndroidNativeArm64PublicationToMavenRepository
|
|
||||||
publishAndroidNativeX64PublicationToMavenRepository
|
|
||||||
publishAndroidNativeX86PublicationToMavenRepository
|
|
||||||
publishJsPublicationToMavenRepository
|
|
||||||
publishJvmPublicationToMavenRepository
|
|
||||||
publishKotlinMultiplatformPublicationToMavenRepository
|
|
||||||
publishLinuxArm64PublicationToMavenRepository
|
|
||||||
publishLinuxX64PublicationToMavenRepository
|
|
||||||
publishWasmJsPublicationToMavenRepository
|
|
||||||
|
|
||||||
# ./gradlew tasks | grep "PublicationToMavenRepository" | grep "publishMingw" | cut -d ' ' -f 1
|
|
||||||
- if: matrix.os == 'windows-latest'
|
|
||||||
run: >
|
|
||||||
./gradlew
|
|
||||||
publishMingwX64PublicationToMavenRepository
|
|
||||||
|
|
||||||
# ./gradlew tasks | grep "PublicationToMavenRepository" | grep -e "publishIos" -e "publishMacos" -e "publishTvos" -e "publishWatchos" | cut -d ' ' -f 1
|
|
||||||
- if: matrix.os == 'macos-11'
|
|
||||||
run: >
|
|
||||||
./gradlew
|
|
||||||
publishIosArm64PublicationToMavenRepository
|
|
||||||
publishIosSimulatorArm64PublicationToMavenRepository
|
|
||||||
publishIosX64PublicationToMavenRepository
|
|
||||||
publishMacosArm64PublicationToMavenRepository
|
|
||||||
publishMacosX64PublicationToMavenRepository
|
|
||||||
publishTvosArm64PublicationToMavenRepository
|
|
||||||
publishTvosSimulatorArm64PublicationToMavenRepository
|
|
||||||
publishTvosX64PublicationToMavenRepository
|
|
||||||
publishWatchosArm32PublicationToMavenRepository
|
|
||||||
publishWatchosArm64PublicationToMavenRepository
|
|
||||||
publishWatchosSimulatorArm64PublicationToMavenRepository
|
|
||||||
publishWatchosX64PublicationToMavenRepository
|
|
||||||
|
|
97
.github/workflows/deploy.yaml
vendored
Normal file
97
.github/workflows/deploy.yaml
vendored
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
uses: ./.github/workflows/build.yaml
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: publishAndroidNativeArm32PublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishAndroidNativeArm64PublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishAndroidNativeX64PublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishAndroidNativeX86PublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishJsPublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishJvmPublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishKotlinMultiplatformPublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishLinuxArm64PublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishLinuxX64PublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishWasmJsPublicationToMavenRepository
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: publishMingwX64PublicationToMavenRepository
|
||||||
|
os: windows-latest
|
||||||
|
- target: publishIosArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishIosSimulatorArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishIosX64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishMacosArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishMacosX64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishTvosArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishTvosSimulatorArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishTvosX64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishWatchosArm32PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishWatchosArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishWatchosSimulatorArm64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
- target: publishWatchosX64PublicationToMavenRepository
|
||||||
|
os: macos-latest
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
|
||||||
|
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
|
||||||
|
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
|
||||||
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
||||||
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Validate Gradle Wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v2
|
||||||
|
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.konan
|
||||||
|
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
|
||||||
|
|
||||||
|
- name: Setup JDK
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 8
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v3
|
||||||
|
|
||||||
|
- name: Publish with Gradle Wrapper
|
||||||
|
run: ./gradlew ${{ matrix.target }}
|
Loading…
Reference in New Issue
Block a user