1.6.0 #65
Workflow file for this run
This file contains 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: Flutter Release Build CI | |
on: | |
release: | |
types: [prereleased] | |
permissions: | |
contents: write | |
env: | |
FLUTTER_VERSION: "3.24.2" | |
LINUX_DEPENDENCIES: git unzip zip xz-utils curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libjsoncpp25 libsecret-1-dev libsecret-1-0 librhash0 libsqlite3-dev libappindicator3-dev gettext | |
jobs: | |
build-linux-x86_64: | |
runs-on: ubuntu-latest | |
env: | |
TARBALL_NAME: libretrack-${{ github.event.release.tag_name }}-linux-x86_64.tar.gz | |
outputs: | |
hashsum: ${{ steps.gen-hashsum.outputs.hashsum }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Disable Google Analytics | |
run: flutter config --no-analytics | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Enable Linux support | |
run: flutter config --enable-linux-desktop | |
- name: Install dependencies | |
run: sudo apt update && sudo apt install ${{ env.LINUX_DEPENDENCIES }} -y | |
- name: Build | |
run: flutter build linux --release | |
- name: Create tarball | |
id: create-tar | |
run: | | |
cd build/linux/x64/release/bundle | |
tar -czf ../${{ env.TARBALL_NAME }} * | |
echo "assets-path=build/linux/x64/release" >> "$GITHUB_OUTPUT" | |
- name: Generate hashsum | |
id: gen-hashsum | |
run: | | |
cd ${{ steps.create-tar.outputs.assets-path }} | |
echo "hashsum=$(sha256sum ${{ env.TARBALL_NAME }})" >> "$GITHUB_OUTPUT" | |
- name: Upload assets | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
prerelease: true | |
files: ${{ steps.create-tar.outputs.assets-path }}/${{ env.TARBALL_NAME }} | |
build-linux-arm64: | |
runs-on: ubuntu-latest | |
env: | |
TARBALL_NAME: libretrack-${{ github.event.release.tag_name }}-linux-arm64.tar.gz | |
outputs: | |
hashsum: ${{ steps.gen-hashsum.outputs.hashsum }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Build | |
id: build | |
with: | |
arch: aarch64 | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
# Create an artifacts directory | |
setup: | | |
mkdir -p "${PWD}/artifacts" | |
# Mount the artifacts directory as /artifacts in the container | |
dockerRunArgs: | | |
--volume "${PWD}/artifacts:/artifacts" | |
install: | | |
apt update && apt install ${{ env.LINUX_DEPENDENCIES }} -y | |
git clone https://github.com/flutter/flutter.git -b ${{ env.FLUTTER_VERSION }} /flutter | |
run: | | |
export PATH="$PATH:/flutter/bin" | |
flutter config --no-analytics | |
flutter pub get | |
flutter config --enable-linux-desktop | |
flutter build linux --release | |
echo "::set-output name=assets-path::${PWD}/artifacts" | |
cd build/linux/arm64/release/bundle | |
tar -czf /artifacts/${{ env.TARBALL_NAME }} * | |
- name: Generate hashsum | |
id: gen-hashsum | |
run: | | |
cd ${{ steps.build.outputs.assets-path }} | |
echo "::set-output name=hashsum::$(sha256sum ${{ env.TARBALL_NAME }})" | |
- name: Upload assets | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
prerelease: true | |
files: ${{ steps.build.outputs.assets-path }}/${{ env.TARBALL_NAME }} | |
build-linux-snap: | |
runs-on: ubuntu-latest | |
env: | |
SNAP_NAME: libretrack_${{ github.event.release.tag_name }}_linux_unsigned_${{ matrix.platform }}.snap | |
strategy: | |
matrix: | |
platform: | |
- amd64 | |
- arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: diddlesnaps/snapcraft-multiarch-action@v1 | |
id: snapcraft | |
with: | |
architecture: ${{ matrix.platform }} | |
- name: Upload assets | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
prerelease: true | |
files: ${{ steps.snapcraft.outputs.snap }} | |
build-android-debug: | |
runs-on: ubuntu-latest | |
env: | |
APK_NAME: LibreTrack-${{ github.event.release.tag_name }}-debug.apk | |
outputs: | |
versionNum: ${{ steps.apk-info.outputs.versionNum }} | |
versionCode: ${{ steps.apk-info.outputs.versionCode }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Disable Google Analytics | |
run: flutter config --no-analytics | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Build debug Android APK | |
id: build | |
run: | | |
flutter build apk --flavor base --debug | |
cd build/app/outputs/flutter-apk/ | |
mv app-base-debug.apk "$APK_NAME" | |
echo "assets-path=build/app/outputs/flutter-apk" >> "$GITHUB_OUTPUT" | |
- name: Extract APK version code | |
id: apk-info | |
uses: 8Mi-Tech/get-apk-info-action@master | |
with: | |
apkPath: ${{ steps.build.outputs.assets-path }}/${{ env.APK_NAME }} | |
generate-metadata-assets: | |
runs-on: ubuntu-latest | |
needs: [build-linux-x86_64, build-linux-arm64, build-android-debug] | |
env: | |
HASHSUM_FILE: hashsum.txt | |
VERSION_FILE: version.txt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create assests | |
env: | |
HASHSUM_AMD64: ${{ needs.build-linux-x86_64.outputs.hashsum }} | |
HASHSUM_ARM64: ${{ needs.build-linux-arm64.outputs.hashsum }} | |
ANDROID_BUILD_NAME: ${{ needs.build-android-debug.outputs.versionNum }} | |
ANDROID_BUILD_NUMBER: ${{ needs.build-android-debug.outputs.versionCode }} | |
run: | | |
echo "$HASHSUM_AMD64" >> $HASHSUM_FILE | |
echo "$HASHSUM_ARM64" >> $HASHSUM_FILE | |
echo "android-build-name=$ANDROID_BUILD_NAME" >> $VERSION_FILE | |
echo "android-build-number=$ANDROID_BUILD_NUMBER" >> $VERSION_FILE | |
- name: Upload assets | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
prerelease: true | |
files: | | |
${{ env.HASHSUM_FILE }} | |
${{ env.VERSION_FILE }} |