From bcb9a8375e7e3c9e0ae97e9e1c6944d601b2a0f7 Mon Sep 17 00:00:00 2001 From: ReBlast Date: Thu, 7 Nov 2024 14:12:01 +0500 Subject: [PATCH] ci: configure github actions --- .github/workflows/build.yml | 45 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0964a54 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Build + +permissions: + contents: read + +on: + push: + branches: + - master + pull_request: + branches: + - master + +defaults: + run: + shell: bash + +jobs: + build: + name: Build + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '8' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Cache Konan + id: cache-kotlin-konan + uses: actions/cache@v3 + with: + path: | + ~/.konan/**/* + key: kotlin-konan + + - name: Build project + run: ./gradlew build --build-cache --parallel --no-daemon diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..474b46f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +permissions: + contents: read + +on: + push: + tags: + - v* + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + publish: + name: Build and Publish + runs-on: macos-latest + if: ${{ !contains(github.event.head_commit.message, '#skip') }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '8' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Cache Konan + id: cache-kotlin-konan + uses: actions/cache@v3 + with: + path: | + ~/.konan/**/* + key: kotlin-konan + + - name: Publish to Maven Central + run: ./gradlew publishAllPublicationsToMavenCentralRepository + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}