mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-27 10:11:48 -04:00
ci: release flow tweaks (#4723)
This commit is contained in:
122
.github/workflows/create-or-promote-release.yml
vendored
122
.github/workflows/create-or-promote-release.yml
vendored
@@ -106,112 +106,6 @@ jobs:
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Update External Assets (Firmware, Hardware, Protos)
|
||||
if: ${{ !inputs.dry_run && inputs.channel == 'internal' }}
|
||||
run: |
|
||||
# Update Submodules (Protobufs)
|
||||
echo "Updating core/proto submodule..."
|
||||
git submodule update --init --remote core/proto
|
||||
|
||||
# Update Firmware List
|
||||
firmware_file_path="app/src/main/assets/firmware_releases.json"
|
||||
temp_firmware_file="/tmp/new_firmware_releases.json"
|
||||
|
||||
echo "Fetching latest firmware releases..."
|
||||
curl -s --fail https://api.meshtastic.org/github/firmware/list > "$temp_firmware_file"
|
||||
|
||||
if ! jq empty "$temp_firmware_file" 2>/dev/null; then
|
||||
echo "::error::Firmware API returned invalid JSON data. Aborting."
|
||||
exit 1
|
||||
else
|
||||
if [ ! -f "$firmware_file_path" ] || ! jq --sort-keys . "$temp_firmware_file" | diff -q - <(jq --sort-keys . "$firmware_file_path"); then
|
||||
echo "Changes detected in firmware list or local file missing. Updating $firmware_file_path."
|
||||
cp "$temp_firmware_file" "$firmware_file_path"
|
||||
else
|
||||
echo "No changes detected in firmware list."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update Hardware List
|
||||
hardware_file_path="app/src/main/assets/device_hardware.json"
|
||||
temp_hardware_file="/tmp/new_device_hardware.json"
|
||||
|
||||
echo "Fetching latest device hardware data..."
|
||||
curl -s --fail https://api.meshtastic.org/resource/deviceHardware > "$temp_hardware_file"
|
||||
|
||||
if ! jq empty "$temp_hardware_file" 2>/dev/null; then
|
||||
echo "::error::Hardware API returned invalid JSON data. Aborting."
|
||||
exit 1
|
||||
else
|
||||
if [ ! -f "$hardware_file_path" ] || ! jq --sort-keys . "$temp_hardware_file" | diff -q - <(jq --sort-keys . "$hardware_file_path"); then
|
||||
echo "Changes detected in hardware list or local file missing. Updating $hardware_file_path."
|
||||
cp "$temp_hardware_file" "$hardware_file_path"
|
||||
else
|
||||
echo "No changes detected in hardware list."
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Sync with Crowdin
|
||||
if: ${{ !inputs.dry_run && inputs.channel == 'internal' }}
|
||||
uses: crowdin/github-action@v2
|
||||
with:
|
||||
base_url: 'https://meshtastic.crowdin.com/api/v2'
|
||||
config: 'crowdin.yml'
|
||||
crowdin_branch_name: 'main'
|
||||
upload_sources: true
|
||||
upload_sources_args: '--preserve-hierarchy'
|
||||
upload_translations: false
|
||||
download_translations: true
|
||||
download_translations_args: '--preserve-hierarchy'
|
||||
create_pull_request: false
|
||||
push_translations: false
|
||||
push_sources: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||
|
||||
- name: Commit Release Assets (Translations, Data, Config)
|
||||
if: ${{ !inputs.dry_run && inputs.channel == 'internal' }}
|
||||
env:
|
||||
FINAL_TAG: ${{ steps.calculate_tags.outputs.final_tag }}
|
||||
run: |
|
||||
# Calculate Version Code
|
||||
OFFSET=$(grep '^VERSION_CODE_OFFSET=' config.properties | cut -d'=' -f2)
|
||||
COMMIT_COUNT=$(git rev-list --count HEAD)
|
||||
# +1 because we are about to add a commit
|
||||
VERSION_CODE=$((COMMIT_COUNT + OFFSET + 1))
|
||||
|
||||
echo "Calculated Version Code: $VERSION_CODE"
|
||||
|
||||
# Update VERSION_NAME_BASE in config.properties
|
||||
sed -i "s/^VERSION_NAME_BASE=.*/VERSION_NAME_BASE=${{ inputs.base_version }}/" config.properties
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
# Add updated data files
|
||||
git add config.properties
|
||||
git add app/src/main/assets/firmware_releases.json || true
|
||||
git add app/src/main/assets/device_hardware.json || true
|
||||
git add core/proto || true
|
||||
|
||||
# Add updated translations (fastlane metadata and strings)
|
||||
git add fastlane/metadata/android || true
|
||||
git add "**/strings.xml" || true
|
||||
|
||||
# Only commit if there are changes
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "chore(release): prepare $FINAL_TAG [skip ci]
|
||||
|
||||
- Bump base version to ${{ inputs.base_version }}
|
||||
- Sync translations and assets"
|
||||
git push origin HEAD:${{ github.ref_name }}
|
||||
else
|
||||
echo "No changes to commit."
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Create and Push Release Tag
|
||||
if: ${{ !inputs.dry_run && inputs.channel == 'internal' }}
|
||||
env:
|
||||
@@ -244,3 +138,19 @@ jobs:
|
||||
base_version: ${{ inputs.base_version }}
|
||||
from_channel: ${{ needs.determine-tags.outputs.from_channel }}
|
||||
secrets: inherit
|
||||
|
||||
cleanup-on-failure:
|
||||
needs: [determine-tags, call-release-workflow]
|
||||
if: ${{ failure() && !inputs.dry_run && inputs.channel == 'internal' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Delete Failed Tag
|
||||
env:
|
||||
FINAL_TAG: ${{ needs.determine-tags.outputs.final_tag }}
|
||||
run: |
|
||||
echo "Release workflow failed. Deleting tag $FINAL_TAG to allow a clean retry..."
|
||||
git push origin :refs/tags/"$FINAL_TAG" || echo "Tag was not pushed or already deleted."
|
||||
|
||||
28
.github/workflows/release.yml
vendored
28
.github/workflows/release.yml
vendored
@@ -60,15 +60,6 @@ permissions:
|
||||
attestations: write
|
||||
|
||||
jobs:
|
||||
run-lint:
|
||||
uses: ./.github/workflows/reusable-check.yml
|
||||
with:
|
||||
run_lint: true
|
||||
run_unit_tests: false
|
||||
run_instrumented_tests: false
|
||||
upload_artifacts: false
|
||||
secrets: inherit
|
||||
|
||||
prepare-build-info:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
@@ -85,19 +76,6 @@ jobs:
|
||||
ref: ${{ inputs.tag_name }}
|
||||
fetch-depth: 0
|
||||
submodules: 'recursive'
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'jetbrains'
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
build-scan-publish: true
|
||||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
|
||||
- name: Determine Version Name from Tag
|
||||
id: get_version_name
|
||||
run: echo "APP_VERSION_NAME=$(echo ${{ inputs.tag_name }} | sed 's/-.*//' | sed 's/v//')" >> $GITHUB_OUTPUT
|
||||
@@ -119,7 +97,7 @@ jobs:
|
||||
|
||||
release-google:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prepare-build-info, run-lint]
|
||||
needs: [prepare-build-info]
|
||||
environment: Release
|
||||
env:
|
||||
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
|
||||
@@ -210,7 +188,7 @@ jobs:
|
||||
|
||||
release-fdroid:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prepare-build-info, run-lint]
|
||||
needs: [prepare-build-info]
|
||||
environment: Release
|
||||
env:
|
||||
GRADLE_CACHE_URL: ${{ secrets.GRADLE_CACHE_URL }}
|
||||
@@ -286,7 +264,6 @@ jobs:
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.tag_name }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v8
|
||||
@@ -297,6 +274,7 @@ jobs:
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ inputs.tag_name }}
|
||||
target_commitish: ${{ inputs.commit_sha || github.sha }}
|
||||
name: ${{ inputs.tag_name }} (${{ needs.prepare-build-info.outputs.APP_VERSION_CODE }})
|
||||
generate_release_notes: false
|
||||
files: ./artifacts/*/*
|
||||
|
||||
10
.github/workflows/reusable-check.yml
vendored
10
.github/workflows/reusable-check.yml
vendored
@@ -75,16 +75,12 @@ jobs:
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
||||
cache-cleanup: true
|
||||
cache-cleanup: on-success
|
||||
build-scan-publish: true
|
||||
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
|
||||
build-scan-terms-of-use-agree: 'yes'
|
||||
add-job-summary: always
|
||||
|
||||
- name: Calculate Version Code
|
||||
id: calculate_version_code
|
||||
uses: ./.github/actions/calculate-version-code
|
||||
|
||||
- name: Determine Tasks
|
||||
id: tasks
|
||||
run: |
|
||||
@@ -120,8 +116,6 @@ jobs:
|
||||
- name: Run Flavor Check (with Emulator)
|
||||
if: inputs.run_instrumented_tests == true
|
||||
uses: reactivecircus/android-emulator-runner@v2
|
||||
env:
|
||||
VERSION_CODE: ${{ steps.calculate_version_code.outputs.versionCode }}
|
||||
with:
|
||||
api-level: ${{ matrix.api_level }}
|
||||
arch: x86_64
|
||||
@@ -132,8 +126,6 @@ jobs:
|
||||
|
||||
- name: Run Flavor Check (no Emulator)
|
||||
if: inputs.run_instrumented_tests == false
|
||||
env:
|
||||
VERSION_CODE: ${{ steps.calculate_version_code.outputs.versionCode }}
|
||||
run: ./gradlew ${{ steps.tasks.outputs.tasks }} -Pci=true -PenableComposeCompilerMetrics=true -PenableComposeCompilerReports=true --parallel --configuration-cache --continue --scan
|
||||
|
||||
- name: Upload coverage results to Codecov
|
||||
|
||||
Reference in New Issue
Block a user