diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml index 08e01dd..bd0647d 100644 --- a/.github/workflows/build-and-release.yaml +++ b/.github/workflows/build-and-release.yaml @@ -54,17 +54,21 @@ jobs: echo ${{ secrets.PROPERTIES }} | base64 --decode > key.properties fi - - name: Build ${{ matrix.platform }} app - id: build + - name: Versioning + id: versioning shell: bash run: | ./gradlew ciVersioning + + - name: Build ${{ matrix.platform }} app + shell: bash + run: | ./gradlew ciReleaseApp - if: github.ref == 'refs/heads/main' && github.event_name == 'push' name: Release uses: svenstaro/upload-release-action@v2 with: - tag: refs/tags/v${{ steps.build.outputs.version }} + tag: refs/tags/${{ steps.versioning.outputs.version }} file: build/assets/* file_glob: true diff --git a/build.gradle.kts b/build.gradle.kts index 6556328..e44c936 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -267,9 +267,14 @@ tasks.register("ciVersioning") { dependsOn("updateVersion") doLast { - val outputDir = file(System.getenv("GITHUB_OUTPUT")) - outputDir.writeText("version=${version.substringBefore('+')}") - logger.lifecycle("Wrote version to ${outputDir.absolutePath}") + val outputVersion = "v${version.substringBefore('+')}" + exec { + commandLine = listOf("git", "tag", outputVersion) + isIgnoreExitValue = true + } + exec { commandLine = listOf("git", "push", "origin", outputVersion) } + file(System.getenv("GITHUB_OUTPUT")).writeText("version=$outputVersion") + logger.lifecycle("Wrote version to GitHub output: $outputVersion") } }