name: Release APK on: push: tags: - 'v*.*.*' workflow_dispatch: concurrency: group: build-android-${{ github.ref }} cancel-in-progress: true jobs: build: if: github.server_url == 'https://github.com' runs-on: ubuntu-latest timeout-minutes: 60 permissions: contents: write steps: - name: Free disk space run: | sudo rm -rf /usr/share/dotnet /usr/local/share/boost /opt/ghc sudo rm -rf /usr/local/share/chromium /usr/local/share/powershell sudo rm -rf /usr/share/swift /usr/local/julia* sudo apt-get autoremove -y > /dev/null 2>&1 sudo apt-get clean - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin java-version: '17' - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci - name: Set up Android SDK uses: android-actions/setup-android@v3 - name: Accept Android SDK licenses run: yes | sdkmanager --licenses || true - name: Install SDK components run: | sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0" - name: Cache Gradle uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper key: ${{ runner.os }}-gradle-${{ hashFiles('package.json') }} restore-keys: | ${{ runner.os }}-gradle- - name: Decode keystore run: | mkdir -p ~/.config/sheethappens echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > ~/.config/sheethappens/sheethappens.jks cat > ~/.config/sheethappens/signing.env <<'EOF' KEYSTORE_PATH=~/.config/sheethappens/sheethappens.jks KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }} KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }} KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }} EOF chmod 600 ~/.config/sheethappens/signing.env ~/.config/sheethappens/sheethappens.jks - name: Build signed APK run: ./build-apk.sh - name: Find built APK id: apk run: | APK=$(ls dist/*.apk | sort | tail -1) echo "path=$APK" >> "$GITHUB_OUTPUT" - name: Generate changelog id: changelog run: | PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${{ github.ref_name }}$" | head -1) echo "Previous tag: $PREV_TAG" FEATS=$(git log "${PREV_TAG}..HEAD" --pretty=format:"%s" --no-merges \ | grep -E "^feat(\([^)]+\))?: " \ | sed -E 's/^feat(\([^)]+\))?: //' \ | sed 's/^/- /') FIXES=$(git log "${PREV_TAG}..HEAD" --pretty=format:"%s" --no-merges \ | grep -E "^fix(\([^)]+\))?: " \ | sed -E 's/^fix(\([^)]+\))?: //' \ | sed 's/^/- /') { echo "changelog<> "$GITHUB_OUTPUT" - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: name: "SheetHappens ${{ github.ref_name }}" body: | ## SheetHappens ${{ github.ref_name }} ${{ steps.changelog.outputs.changelog }} ### Installation 1. Enable "Unknown sources" on the device 2. Transfer the APK to the device and open it to install files: ${{ steps.apk.outputs.path }} draft: false prerelease: ${{ contains(github.ref_name, '-') }}