修复一处构建失败问题 #203
Workflow file for this run
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: VersionCheck | |
| on: | |
| merge_group: | |
| pull_request: | |
| branches: [master, refactoring] | |
| paths: | |
| - app/src/** | |
| - build.gradle.kts | |
| - gradle.properties | |
| - settings.gradle | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v3.6.0 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| - name: Build with Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Get version from PR | |
| id: get-pr-version | |
| run: | | |
| chmod +x ${{github.workspace}}/gradlew | |
| echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew -q app:printVersionCode)" | |
| - name: Get current version from main branch | |
| id: get-current-version | |
| run: | | |
| git fetch origin refactoring | |
| git checkout refactoring | |
| chmod +x ./gradlew | |
| echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew -q app:printVersionCode)" | |
| - name: Compare versions | |
| id: compare-versions | |
| run: | | |
| if [ ${{steps.get-pr-version.outputs.VERSION_NAME}} -le ${{steps.get-current-version.outputs.VERSION_NAME}} ] | |
| then | |
| echo "The version in the PR ${{steps.get-pr-version.outputs.VERSION_NAME}} is not higher than the current version ${{steps.get-current-version.outputs.VERSION_NAME}}." | |
| echo "Please increase the debug version number." | |
| exit 1 | |
| fi |