Skip to content

Commit

Permalink
ci: 调整新增标记流程
Browse files Browse the repository at this point in the history
  • Loading branch information
xfqwdsj committed Jan 26, 2024
1 parent 01a8d4b commit dda0c73
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 8 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down

0 comments on commit dda0c73

Please sign in to comment.