Skip to content

Merge pull request #12 from kvmgithub/feature/library-export #12

Merge pull request #12 from kvmgithub/feature/library-export

Merge pull request #12 from kvmgithub/feature/library-export #12

Workflow file for this run

name: Build Signed Release APK
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # GitHub release: v1.0.0
- 'v[0-9]+.[0-9]+.[0-9]+-play' # Play Store release: v1.0.0-play
workflow_dispatch: # Allow manual trigger
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # Required for creating releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Free up disk space
run: |
echo "Disk space before cleanup:"
df -h
# Remove unnecessary files
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker system prune -af
echo "Disk space after cleanup:"
df -h
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract version and build type from tag
id: version
run: |
TAG=${{ github.ref_name }}
VERSION=${TAG#v} # Remove 'v' prefix
VERSION=${VERSION%-play} # Remove '-play' suffix if present
echo "version=$VERSION" >> $GITHUB_OUTPUT
# Play Store builds don't get the update checker
if [[ "$TAG" == *-play ]]; then
echo "github_release=false" >> $GITHUB_OUTPUT
echo "Building Play Store version: $VERSION"
else
echo "github_release=true" >> $GITHUB_OUTPUT
echo "Building GitHub version: $VERSION"
fi
- name: Build signed release APK
env:
GIT_REPO: ${{ github.server_url }}/${{ github.repository }}.git
GIT_BRANCH: ${{ github.ref_name }}
BUILD_TYPE: release
APP_VERSION: ${{ steps.version.outputs.version }}
GITHUB_RELEASE: ${{ steps.version.outputs.github_release }}
KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
chmod +x ./docker-build.sh
./docker-build.sh build
- name: Rename APK with version
run: |
VERSION=${{ github.ref_name }}
sudo mv build-output/app-release.apk build-output/librisync-${VERSION}.apk
- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: librisync-${{ github.ref_name }}
path: build-output/librisync-*.apk
retention-days: 30
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: build-output/librisync-*.apk
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}