meshtastic-android/.github/workflows/release.yml

128 wiersze
4.9 KiB
YAML
Czysty Zwykły widok Historia

2021-12-09 18:01:20 +00:00
name: Make Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version (Example: 1.0.0, must match app/gradle.build 'versionName')"
required: true
default: '1.0.0'
jobs:
release-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Load secrets
run: |
rm ./app/google-services.json
echo $GSERVICES > ./app/google-services.json
rm ./app/src/main/res/values/mapbox-token.xml
2022-03-15 04:33:30 +00:00
echo -e "<resources>\n <string name=\"mapbox_access_token\">$MAPBOX_ACCESS_TOKEN</string>\n</resources>" > ./app/src/main/res/values/mapbox-token.xml
2021-12-09 18:01:20 +00:00
mkdir -p ~/.gradle
2022-03-15 04:33:30 +00:00
echo "MAPBOX_DOWNLOADS_TOKEN=$MAPBOX_DOWNLOADS_TOKEN" >> ~/.gradle/gradle.properties
2021-12-09 18:01:20 +00:00
echo $KEYSTORE | base64 -di > ./app/$KEYSTORE_FILENAME
echo "$KEYSTORE_PROPERTIES" > ./keystore.properties
env:
GSERVICES: ${{ secrets.GSERVICES }}
2022-03-15 04:33:30 +00:00
MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }}
MAPBOX_DOWNLOADS_TOKEN: ${{ secrets.MAPBOX_DOWNLOADS_TOKEN }}
2021-12-09 18:01:20 +00:00
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_FILENAME: ${{ secrets.KEYSTORE_FILENAME }}
KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }}
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
# Note: we don't use caches on release builds because we don't want to accidentally not have a virgin build machine
2021-12-22 18:09:31 +00:00
- name: Find firmware release tag
id: firmware_version
uses: oprypin/find-latest-tag@v1
2021-12-09 18:01:20 +00:00
with:
2021-12-22 18:09:31 +00:00
repository: meshtastic/Meshtastic-device
releases-only: true
token: ${{ secrets.GITHUB_TOKEN }}
2021-12-09 18:01:20 +00:00
2021-12-22 18:09:31 +00:00
- name: Create version strings
2021-12-11 22:38:02 +00:00
run: |
2021-12-22 18:09:31 +00:00
echo "CUR_FIRMWARE_VERSION=$(echo ${{ steps.firmware_version.outputs.tag }}|sed -e 's/^v//')" >> $GITHUB_ENV
echo "SHORT_FIRMWARE_VERSION=$(echo ${{ steps.firmware_version.outputs.tag }}|sed -e 's/^v//' -e 's/.\{8\}$//')" >> $GITHUB_ENV
2021-12-11 22:38:02 +00:00
2021-12-22 18:09:31 +00:00
- name: Create curfirmwareversion.xml
2021-12-11 22:38:02 +00:00
run: |
rm ./app/src/main/res/values/curfirmwareversion.xml
echo -e "<resources>\n <string name=\"cur_firmware_version\" translatable=\"false\">${{ env.CUR_FIRMWARE_VERSION }}</string>\n <string name=\"short_firmware_version\" translatable=\"false\">${{ env.SHORT_FIRMWARE_VERSION }}</string>\n</resources>" > ./app/src/main/res/values/curfirmwareversion.xml
2021-12-09 18:01:20 +00:00
2021-12-22 18:09:31 +00:00
- name: Fetch firmware release
2021-12-09 18:01:20 +00:00
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: meshtastic/Meshtastic-device
2021-12-11 22:38:02 +00:00
file: firmware-${{ env.CUR_FIRMWARE_VERSION }}.zip
2021-12-22 18:09:31 +00:00
version: tags/${{ steps.firmware_version.outputs.tag }}
2021-12-09 18:01:20 +00:00
target: firmware.zip
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip firmware into assets/firmware
run: |
2021-12-22 18:09:31 +00:00
rm -rf ./app/src/main/assets/firmware
mkdir -p ./app/src/main/assets/firmware
2022-03-08 15:36:34 +00:00
unzip -qq ./firmware.zip 'littlefs-*.bin' 'firmware-heltec*.bin' 'firmware-tbeam*.bin' 'firmware-tlora*.bin' -d ./app/src/main/assets/firmware
2021-12-22 18:09:31 +00:00
rm ./firmware.zip
2021-12-09 18:01:20 +00:00
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
2022-01-18 21:56:36 +00:00
- name: Gradle bundleRelease
run: ./gradlew bundleRelease
- name: Gradle assembleRelease
2021-12-09 18:01:20 +00:00
run: ./gradlew assembleRelease
# - name: Upload Release to Play Store
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.GSERVICES }}
# packageName: # TODO put your package name here
# releaseFiles: app/build/outputs/bundle/release/app-release.apk
# track: # TODO specify track here
- name: Create GitHub release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: true
2022-02-03 17:19:33 +00:00
release_name: Meshtastic Android ${{ github.event.inputs.version}} alpha
2021-12-09 18:01:20 +00:00
tag_name: ${{ github.event.inputs.version}}
body: |
Autogenerated by github action, developer should edit as required before publishing...
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2022-01-18 21:56:36 +00:00
- name: Add AAB to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/bundle/release/app-release.aab
asset_name: app-release-${{ github.event.inputs.version}}.aab
asset_content_type: application/zip
2021-12-09 18:01:20 +00:00
- name: Add APK to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/release/app-release.apk
asset_name: app-release-${{ github.event.inputs.version}}.apk
asset_content_type: application/zip