diff --git a/.github/workflows/maven-artifact-alpha.yml b/.github/workflows/maven-artifact-alpha.yml index cf6a65d..5b6383f 100644 --- a/.github/workflows/maven-artifact-alpha.yml +++ b/.github/workflows/maven-artifact-alpha.yml @@ -18,21 +18,14 @@ env: jobs: publish-spm: - permissions: - contents: write - packages: write - uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/faktorybuildautoversion.yml@v1.1 - with: - jvmVersion: 17 - versionBaseProperty: LIBRARY_VERSION - publish-maven: - name: Release build and publish + concurrency: "kmmbridgepublish-${{ github.repository }}" runs-on: macos-12 - permissions: - contents: write - packages: write steps: - - uses: actions/checkout@v4 + - name: Checkout the repo with tags + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - uses: actions/setup-java@v3.6.0 with: java-version: 17 @@ -48,7 +41,12 @@ jobs: uses: nanzm/get-time-action@v1.1 with: timeZone: 0 - format: 'YYYY-MM-DD-HH-mm-ss' + format: 'YYYYMMDDHHmmss' + - uses: touchlab/read-property@main + id: versionprop + with: + file: ./gradle.properties + property: AUTHLIB_VERSION_NAME - name: Print tag to be generated and save into env env: @@ -56,19 +54,112 @@ jobs: run: | echo "Timestamp: $ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP" + - name: Generate SPM version + id: generateSPMversion + env: + SPM_VERSION: "${{ steps.versionprop.outputs.propVal }}${{ steps.time.outputs.time }}" + run: | + spmWithoutAlpha=`echo "${{ steps.versionprop.outputs.propVal }}" | sed 's/-alpha//` + echo "::set-output name=SPM_VERSION::$( + ${spmWithoutAlpha}${{ steps.time.outputs.time }} + )" + - name: Build id: gradle uses: gradle/gradle-build-action@v2.3.3 env: ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}" -# Maybe consider deleting old artifacts here -# - name: Delete old SNAPSHOT -# uses: actions/delete-package-versions@v3.0.1 + - name: Print next SPM version + run: | + echo "${{ steps.generateSPMversion.outputs.SPM_VERSION }}" + + - uses: touchlab/autoversion-tagmarker@main + id: autoversion-tagmarker + with: + nextVersion: ${{ steps.generateSPMversion.outputs.SPM_VERSION }} + + - uses: touchlab/autoversion-buildbranch@main + id: autoversion-buildbranch + with: + buildBranch: "build-${{ steps.generateSPMversion.outputs.SPM_VERSION }}" + +# - uses: extractions/netrc@v1 # with: -# package-name: +# machine: ${{ inputs.netrcMachine }} +# username: ${{ secrets.netrcUsername != '' && secrets.netrcUsername || 'cirunner' }} +# password: ${{ secrets.netrcPassword != '' && secrets.netrcPassword || secrets.GITHUB_TOKEN }} - - name: Publish to GitHub packages - run: ./gradlew publishAllPublicationsToMavenRepository + + - name: Build Main + run: ./gradlew kmmBridgePublish -PAUTO_VERSION=${{ steps.generateSPMversion.outputs.SPM_VERSION }} -PENABLE_PUBLISHING=true -PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} -PGITHUB_REPO=${{ github.repository }} --no-daemon --stacktrace env: - ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}" \ No newline at end of file + GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m" + + - uses: touchlab/autoversion-finishrelease@main + id: autoversion-finishrelease + with: + commitMessage: "KMM SPM package release for ${{ steps.generateSPMversion.outputs.SPM_VERSION }}" + tagMessage: "KMM release version ${{ steps.generateSPMversion.outputs.SPM_VERSION }}" + tagVersion: ${{ steps.generateSPMversion.outputs.SPM_VERSION }} + branchName: "build-${{ steps.generateSPMversion.outputs.SPM_VERSION }}" + + - uses: touchlab/autoversion-tagmarker@main + id: autoversion-tagmarker-cleanup + with: + nextVersion: ${{ steps.generateSPMversion.outputs.SPM_VERSION }} + cleanupMarkers: 'true' + + - name: Delete branch + if: (!inputs.retainBuildBranch) && (!cancelled()) + uses: touchlab/action-delete-branch@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branches: "build-${{ steps.generateSPMversion.outputs.SPM_VERSION }}" +# publish-maven: +# name: Release build and publish +# runs-on: macos-12 +# permissions: +# contents: write +# packages: write +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-java@v3.6.0 +# with: +# java-version: 17 +# distribution: 'zulu' +# - name: Setup Gradle +# uses: gradle/gradle-build-action@v2 +# with: +# cache-read-only: false +# gradle-home-cache-cleanup: true +# +# - name: Generate alpha version timestamp +# id: time +# uses: nanzm/get-time-action@v1.1 +# with: +# timeZone: 0 +# format: 'YYYY-MM-DD-HH-mm-ss' +# +# - name: Print tag to be generated and save into env +# env: +# ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}" +# run: | +# echo "Timestamp: $ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP" +# +# - name: Build +# id: gradle +# uses: gradle/gradle-build-action@v2.3.3 +# env: +# ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}" +# +## Maybe consider deleting old artifacts here +## - name: Delete old SNAPSHOT +## uses: actions/delete-package-versions@v3.0.1 +## with: +## package-name: +# +# - name: Publish to GitHub packages +# run: ./gradlew publishAllPublicationsToMavenRepository +# env: +# ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}" \ No newline at end of file