59b688dafb
Parse feat/fix commits since previous tag and render them as 'What's New' and 'Bug Fixes' sections in the release body. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
139 lines
4.3 KiB
YAML
139 lines
4.3 KiB
YAML
name: Release APK
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
jobs:
|
|
build:
|
|
if: github.server_url == 'https://github.com'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '21'
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Get pnpm store path
|
|
id: pnpm-cache
|
|
shell: bash
|
|
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: Install dependencies
|
|
working-directory: artifacts/postiz-mobile
|
|
run: pnpm install --no-frozen-lockfile
|
|
|
|
- name: Set up Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
|
|
- name: Accept Android SDK licenses
|
|
run: yes | sdkmanager --licenses || true
|
|
|
|
- name: Cache Android NDK
|
|
id: ndk-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /usr/local/lib/android/sdk/ndk/28.2.13676358
|
|
key: ndk-28.2.13676358-v1
|
|
|
|
- name: Install SDK components
|
|
run: |
|
|
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0"
|
|
if [ "${{ steps.ndk-cache.outputs.cache-hit }}" != "true" ]; then
|
|
sdkmanager "ndk;28.2.13676358"
|
|
fi
|
|
|
|
- name: Cache Gradle
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.gradle/caches
|
|
~/.gradle/wrapper
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('artifacts/postiz-mobile/package.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gradle-
|
|
|
|
- name: Decode keystore
|
|
run: |
|
|
mkdir -p ~/.config/postiz-mobile
|
|
echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > ~/.config/postiz-mobile/postiz-mobile.jks
|
|
cat > ~/.config/postiz-mobile/signing.env <<EOF
|
|
KEYSTORE_PATH=~/.config/postiz-mobile/postiz-mobile.jks
|
|
KEYSTORE_ALIAS=${{ secrets.KEYSTORE_ALIAS }}
|
|
KEYSTORE_STORE_PASSWORD=${{ secrets.KEYSTORE_STORE_PASSWORD }}
|
|
KEYSTORE_KEY_PASSWORD=${{ secrets.KEYSTORE_KEY_PASSWORD }}
|
|
EOF
|
|
chmod 600 ~/.config/postiz-mobile/signing.env ~/.config/postiz-mobile/postiz-mobile.jks
|
|
|
|
- name: Build signed APK
|
|
working-directory: artifacts/postiz-mobile
|
|
run: ./build-apk.sh
|
|
|
|
- name: Find built APK
|
|
id: apk
|
|
run: |
|
|
APK=$(ls artifacts/postiz-mobile/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<<CEOF"
|
|
[ -n "$FEATS" ] && printf "### What's New\n%s\n\n" "$FEATS"
|
|
[ -n "$FIXES" ] && printf "### Bug Fixes\n%s\n\n" "$FIXES"
|
|
echo "CEOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: "Postiz Mobile ${{ github.ref_name }}"
|
|
body: |
|
|
## Postiz Mobile ${{ 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, '-') }}
|