Deploy developing version of BenRomdhaneOmar/kotlin-monads-multiplatform-library triggered by a push event. #41
This file contains hidden or 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: Deploy developing version | |
| run-name: Deploy developing version of ${{ github.repository }} triggered by a ${{ github.event_name }} event. | |
| on: | |
| push: | |
| branches: [ dev ] | |
| jobs: | |
| Deploy-Dev-Actions: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: write | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.ACTION_PAT }} | |
| fetch-depth: 0 | |
| - name: List files in the repository | |
| run: | | |
| ls -lR ${{ github.workspace }} | |
| - name: Set up Java 25 | |
| run: echo "JAVA_HOME=$JAVA_HOME_25_X64" >> $GITHUB_ENV | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: ${{ runner.os }}-gradle | |
| - name: Set up gradle | |
| run: ./gradlew -version | |
| - name: Wasm Js Browser Test | |
| run: ./gradlew clean wasmJsBrowserTest | |
| - name: Wasm Js Test | |
| run: ./gradlew clean wasmJsTest | |
| - name: Linux X64 Test | |
| run: ./gradlew clean linuxX64Test | |
| - name: Jvm Test | |
| run: ./gradlew clean jvmTest | |
| - name: Run Detekt Analysis | |
| run: ./gradlew detekt | |
| - name: Increment version | |
| id: version | |
| run: | | |
| CURRENT_VERSION=$(grep "library.version=" gradle.properties | cut -d'=' -f2) | |
| echo "Current version: $CURRENT_VERSION" | |
| MAJOR=$(echo "$CURRENT_VERSION" | cut -d'.' -f1) | |
| echo "Current major: $MAJOR" | |
| MINOR=$(echo "$CURRENT_VERSION" | cut -d'.' -f2) | |
| echo "Current minor: $MINOR" | |
| PATCH=$(echo "$CURRENT_VERSION" | cut -d'.' -f3) | |
| echo "Current patch: $PATCH" | |
| NEW_PATCH=$((PATCH + 1)) | |
| echo "New patch: $PATCH" | |
| NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" | |
| echo "New version: $NEW_VERSION" | |
| sed -i "s/library\.version=.*/library\.version=$NEW_VERSION/" gradle.properties | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| - name: Commit version bump | |
| run: | | |
| git config user.name "kotlin-monads-multiplatform-library-github-actions[bot]" | |
| git config user.email "kotlin-monads-multiplatform-library-github-actions[bot]@users.noreply.github.com" | |
| git add gradle.properties | |
| git commit -m "chore: bump version to ${{ steps.version.outputs.new_version }} [skip ci]" | |
| git push | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Generate Kover reports | |
| run: ./gradlew koverXmlReport | |
| - name: Run SonarCloud Analysis | |
| run: | | |
| ./gradlew sonar \ | |
| -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \ | |
| -Dsonar.organization=${{ secrets.SONAR_ORG }} \ | |
| -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| - name: Publish to MavenCentral | |
| run: ./gradlew publishToMavenCentral --no-configuration-cache | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY_CONTENTS }} |