sign build
This commit is contained in:
@@ -185,24 +185,54 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Build for Android
|
||||
run: bun run tauri android build
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ android.ndk-home }}
|
||||
ANDROID_SDK_ROOT: ${{ android.sdk-root }}
|
||||
ANDROID_HOME: ${{ android.sdk-root }}
|
||||
- name: Resolve Android NDK path
|
||||
run: echo "ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/25.1.8937393" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Prepare Android artifacts
|
||||
- name: Set app version from tag
|
||||
run: |
|
||||
REF="${GITHUB_REF#refs/tags/v}"
|
||||
VERSION="${REF#refs/heads/}"
|
||||
# On non-tag runs keep whatever is in tauri.conf.json
|
||||
if echo "$GITHUB_REF" | grep -q '^refs/tags/v'; then
|
||||
echo "Setting version to $VERSION"
|
||||
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json
|
||||
fi
|
||||
grep '"version"' src-tauri/tauri.conf.json
|
||||
|
||||
- name: Initialize Android project
|
||||
run: bun run tauri android init
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_HOME }}
|
||||
|
||||
- name: Sync custom Android sources & gradle config
|
||||
run: ./scripts/sync-android-sources.sh
|
||||
|
||||
- name: Write signing keystore
|
||||
run: |
|
||||
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > "$RUNNER_TEMP/jellytau-release.jks"
|
||||
cat > src-tauri/gen/android/keystore.properties <<EOF
|
||||
storeFile=$RUNNER_TEMP/jellytau-release.jks
|
||||
storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||
keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||
EOF
|
||||
|
||||
- name: Build signed Android APK
|
||||
run: bun run tauri android build --apk
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ env.ANDROID_NDK_HOME }}
|
||||
ANDROID_SDK_ROOT: ${{ env.ANDROID_SDK_ROOT }}
|
||||
ANDROID_HOME: ${{ env.ANDROID_SDK_ROOT }}
|
||||
|
||||
- name: Collect & verify signed APK
|
||||
run: |
|
||||
mkdir -p dist/android
|
||||
# Copy APK
|
||||
if [ -f "src-tauri/gen/android/app/build/outputs/apk/release/app-release.apk" ]; then
|
||||
cp src-tauri/gen/android/app/build/outputs/apk/release/app-release.apk dist/android/jellytau-release.apk
|
||||
fi
|
||||
# Copy AAB (Android App Bundle) if built
|
||||
if [ -f "src-tauri/gen/android/app/build/outputs/bundle/release/app-release.aab" ]; then
|
||||
cp src-tauri/gen/android/app/build/outputs/bundle/release/app-release.aab dist/android/jellytau-release.aab
|
||||
fi
|
||||
APK=$(find src-tauri/gen/android/app/build/outputs/apk -name '*-release.apk' | head -1)
|
||||
if [ -z "$APK" ]; then echo "❌ No release APK produced"; exit 1; fi
|
||||
cp "$APK" dist/android/jellytau-release.apk
|
||||
APKSIGNER=$(find "$ANDROID_SDK_ROOT/build-tools" -name apksigner | sort -V | tail -1)
|
||||
echo "🔏 Verifying signature with $APKSIGNER"
|
||||
"$APKSIGNER" verify --print-certs dist/android/jellytau-release.apk
|
||||
ls -lah dist/android/
|
||||
|
||||
- name: Upload Android build artifact
|
||||
@@ -294,44 +324,41 @@ jobs:
|
||||
echo "---" >> release_notes.md
|
||||
echo "Built with Tauri, SvelteKit, and Rust 🦀" >> release_notes.md
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: ${{ steps.tag_name.outputs.RELEASE_NAME }}
|
||||
body_path: release_notes.md
|
||||
files: |
|
||||
artifacts/linux/*
|
||||
artifacts/android/*
|
||||
draft: false
|
||||
prerelease: ${{ contains(steps.tag_name.outputs.VERSION, 'rc') || contains(steps.tag_name.outputs.VERSION, 'beta') || contains(steps.tag_name.outputs.VERSION, 'alpha') }}
|
||||
- name: Publish Gitea release & upload assets
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload to Gitea Releases
|
||||
# GITEA_TOKEN (a PAT) is preferred; falls back to the auto-provided token.
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
AUTO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
command -v jq >/dev/null || { echo "❌ jq is required on the runner"; exit 1; }
|
||||
VERSION="${{ steps.tag_name.outputs.VERSION }}"
|
||||
API="${GITHUB_SERVER_URL}/api/v1"
|
||||
REPO="${GITHUB_REPOSITORY}"
|
||||
TOKEN="${GITEA_TOKEN:-$AUTO_TOKEN}"
|
||||
case "$VERSION" in *rc*|*beta*|*alpha*) PRE=true;; *) PRE=false;; esac
|
||||
|
||||
echo "📦 Release artifacts prepared for $VERSION"
|
||||
echo ""
|
||||
echo "Linux:"
|
||||
ls -lh artifacts/linux/ || echo "No Linux artifacts"
|
||||
echo ""
|
||||
echo "Android:"
|
||||
ls -lh artifacts/android/ || echo "No Android artifacts"
|
||||
echo ""
|
||||
echo "✅ Release $VERSION is ready!"
|
||||
echo "📄 Release notes saved to release_notes.md"
|
||||
PAYLOAD=$(jq -n \
|
||||
--arg tag "$VERSION" \
|
||||
--arg name "JellyTau $VERSION" \
|
||||
--rawfile body release_notes.md \
|
||||
--argjson pre "$PRE" \
|
||||
'{tag_name:$tag, name:$name, body:$body, draft:false, prerelease:$pre}')
|
||||
|
||||
- name: Publish release notes
|
||||
run: |
|
||||
echo "## 🎉 Release Published"
|
||||
echo ""
|
||||
echo "**Version:** ${{ steps.tag_name.outputs.VERSION }}"
|
||||
echo "**Tag:** ${{ github.ref }}"
|
||||
echo ""
|
||||
echo "Artifacts:"
|
||||
echo "- Linux artifacts in: artifacts/linux/"
|
||||
echo "- Android artifacts in: artifacts/android/"
|
||||
echo ""
|
||||
echo "Visit the Release page to download files."
|
||||
echo "📦 Creating release $VERSION on $REPO"
|
||||
RESP=$(curl -fsS -X POST "$API/repos/$REPO/releases" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD")
|
||||
RELEASE_ID=$(echo "$RESP" | jq -r '.id')
|
||||
echo "Release id=$RELEASE_ID"
|
||||
|
||||
for f in artifacts/android/* artifacts/linux/*; do
|
||||
[ -f "$f" ] || continue
|
||||
echo "⬆️ Uploading $(basename "$f")"
|
||||
curl -fsS -X POST \
|
||||
"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$(basename "$f")" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-F "attachment=@$f" >/dev/null
|
||||
done
|
||||
echo "✅ Release $VERSION published with assets"
|
||||
|
||||
Reference in New Issue
Block a user