improve automated MapLibre Android release (#3497)
This commit is contained in:
45
.github/workflows/android-ci.yml
vendored
45
.github/workflows/android-ci.yml
vendored
@@ -46,8 +46,6 @@ jobs:
|
||||
BUILDTYPE: Debug
|
||||
IS_LOCAL_DEVELOPMENT: false
|
||||
MLN_ANDROID_STL: c++_static
|
||||
outputs:
|
||||
make_release: ${{ steps.make_release.outputs.make_release }}
|
||||
steps:
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
if: startsWith(runner.name, 'GitHub Actions')
|
||||
@@ -67,8 +65,8 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Validate VERSION
|
||||
run: ../../.github/scripts/validate-version.sh
|
||||
working-directory: platform/android
|
||||
run: .github/scripts/validate-version.sh platform/android/VERSION
|
||||
working-directory: .
|
||||
|
||||
- run: echo "cmake.dir=$(dirname "$(dirname "$(command -v cmake)")")" >> local.properties
|
||||
|
||||
@@ -206,17 +204,6 @@ jobs:
|
||||
platform/android/InstrumentationTestApp.apk
|
||||
platform/android/InstrumentationTests.apk
|
||||
|
||||
- name: VERSION file changed
|
||||
id: version-file-android-changed
|
||||
uses: tj-actions/changed-files@v46
|
||||
with:
|
||||
files: platform/android/VERSION
|
||||
|
||||
- name: Should make release?
|
||||
id: make_release
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.version-file-android-changed.outputs.any_changed == 'true'
|
||||
run: echo make_release=true >> "$GITHUB_OUTPUT"
|
||||
|
||||
android-build-cpp-test:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
@@ -352,11 +339,33 @@ jobs:
|
||||
if: env.success != 'true'
|
||||
run: exit 1
|
||||
|
||||
# automatically trigger android-release when code is pushed to main
|
||||
# and the platform/android/VERSION file has changed
|
||||
- uses: actions/checkout@v4
|
||||
if: needs.android-build.outputs.make_release == 'true' && env.success
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
|
||||
- name: VERSION file changed
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
id: version-file-android-changed
|
||||
uses: tj-actions/changed-files@v46
|
||||
with:
|
||||
files: platform/android/VERSION
|
||||
|
||||
- name: Should make release?
|
||||
if: env.success && github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.version-file-android-changed.outputs.any_changed == 'true'
|
||||
run: echo make_release=true >> "$GITHUB_ENV"
|
||||
|
||||
- name: Validate and set version
|
||||
if: env.make_release == 'true'
|
||||
working-directory: .
|
||||
run: .github/scripts/validate-version.sh platform/android/VERSION
|
||||
|
||||
- name: Create tag if it does not exist
|
||||
if: env.make_release == 'true'
|
||||
run: .github/scripts/ensure-tag.sh android-v${{ env.version }} ${{ github.sha }}
|
||||
|
||||
- name: Trigger release
|
||||
if: needs.android-build.outputs.make_release == 'true' && env.success
|
||||
run: gh workflow run android-release.yml --ref ${{ github.sha }}
|
||||
if: env.make_release == 'true'
|
||||
run: gh workflow run android-release.yml --ref android-v${{ env.version }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
23
.github/workflows/android-release.yml
vendored
23
.github/workflows/android-release.yml
vendored
@@ -37,7 +37,8 @@ jobs:
|
||||
run: make run-android-nitpick
|
||||
|
||||
- name: Validate and set version
|
||||
run: ../../.github/scripts/validate-version.sh
|
||||
working-directory: .
|
||||
run: .github/scripts/validate-version.sh platform/android/VERSION
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
@@ -69,24 +70,8 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Create tag if it does not exist
|
||||
run: |
|
||||
git config user.name "MapLibre Team"
|
||||
git config user.email "team@maplibre.org"
|
||||
tag="android-v${{ env.version }}"
|
||||
|
||||
if git rev-parse "$tag" >/dev/null 2>&1; then
|
||||
tag_sha=$(git rev-parse "$tag^{commit}")
|
||||
if [ "$tag_sha" = "${{ github.sha }}" ]; then
|
||||
echo "✅ Tag $tag exists and matches current commit SHA."
|
||||
exit 0
|
||||
else
|
||||
echo "::error::❌ Tag $tag exists but points to a different commit. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
git tag -a "$tag" -m "Publish $tag" ${{ github.sha }}
|
||||
git push origin "$tag"
|
||||
fi
|
||||
working-directory: .
|
||||
run: .github/scripts/ensure-tag.sh android-v${{ env.version }} ${{ github.sha }}
|
||||
|
||||
- name: Create release
|
||||
id: create_release
|
||||
|
||||
Reference in New Issue
Block a user