mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-05-25 10:24:34 +00:00
ci: release nightly builds on all changes
This commit is contained in:
115
.github/workflows/ci-android.yml
vendored
115
.github/workflows/ci-android.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Build APK and root module (and create nightly release)
|
name: Android CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -6,95 +6,74 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
paths:
|
paths:
|
||||||
- 'android/**'
|
- 'android/**'
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
release:
|
|
||||||
description: 'Create a nightly release'
|
|
||||||
required: true
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
custom_notes:
|
|
||||||
description: 'Custom updates to add to What''s Changed section'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-debug-apk:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
short_sha: ${{ steps.vars.outputs.short_sha }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: zulu
|
||||||
java-version: 21
|
java-version: 21
|
||||||
- uses: gradle/actions/setup-gradle@v4
|
- uses: gradle/actions/setup-gradle@v4
|
||||||
- name: Build debug APK
|
- name: Decode keystore
|
||||||
run: ./gradlew assembleDebug
|
run: echo "${{ secrets.RELEASE_KEYSTORE_FILE }}" | base64 --decode > android/release.keystore
|
||||||
|
- name: Create local.properties
|
||||||
|
run: |
|
||||||
|
cat <<EOF > android/local.properties
|
||||||
|
RELEASE_STORE_FILE=release.keystore
|
||||||
|
RELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }}
|
||||||
|
RELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }}
|
||||||
|
RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}
|
||||||
|
EOF
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew packageReleaseArtifacts
|
||||||
working-directory: android
|
working-directory: android
|
||||||
- name: Upload artifact
|
- id: vars
|
||||||
uses: actions/upload-artifact@v4
|
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Debug APK
|
name: release-artifacts
|
||||||
path: android/app/build/outputs/apk/**/*.apk
|
path: release/*
|
||||||
nightly-release:
|
|
||||||
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/release-nightly' || github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true'
|
needs: build
|
||||||
needs: build-debug-apk
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
- name: Export APK_NAME for later use
|
with:
|
||||||
run: echo "APK_NAME=LibrePods-$(echo ${{ github.sha }} | cut -c1-7).apk" >> $GITHUB_ENV
|
name: release-artifacts
|
||||||
- name: Rename .apk file
|
path: artifacts
|
||||||
run: mv "./Debug APK/debug/"*.apk "./$APK_NAME"
|
- id: prev
|
||||||
- name: Decode keystore file
|
|
||||||
run: echo "${{ secrets.DEBUG_KEYSTORE_FILE }}" | base64 --decode > debug.keystore
|
|
||||||
- name: Install apksigner
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y apksigner
|
|
||||||
- name: Sign APK
|
|
||||||
run: |
|
run: |
|
||||||
apksigner sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android --key-pass pass:android "./$APK_NAME"
|
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||||
- name: Verify APK
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||||
run: apksigner verify "./$APK_NAME"
|
- id: changelog
|
||||||
- name: Fetch the latest non-nightly release tag
|
|
||||||
id: fetch-tag
|
|
||||||
run: echo "::set-output name=tag::$(git describe --tags $(git rev-list --tags --max-count=1))"
|
|
||||||
- name: Retrieve commits since the last release
|
|
||||||
id: get-commits
|
|
||||||
run: |
|
run: |
|
||||||
COMMITS=$(git log ${{ steps.fetch-tag.outputs.tag }}..HEAD --pretty=format:"- %s (%h)" --abbrev-commit)
|
if [ -z "${{ steps.prev.outputs.tag }}" ]; then
|
||||||
echo "::set-output name=commits::${COMMITS}"
|
NOTES=$(git log --pretty=format:"- %s (%h)")
|
||||||
- name: Prepare release notes
|
else
|
||||||
id: release-notes
|
NOTES=$(git log ${{ steps.prev.outputs.tag }}..HEAD --pretty=format:"- %s (%h)")
|
||||||
run: |
|
|
||||||
# Create a temporary file for release notes
|
|
||||||
NOTES_FILE=$(mktemp)
|
|
||||||
|
|
||||||
# Process custom notes if they exist
|
|
||||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.custom_notes }}" ]; then
|
|
||||||
CUSTOM_NOTES="${{ github.event.inputs.custom_notes }}"
|
|
||||||
|
|
||||||
# Check if custom notes already have bullet points or GitHub-style formatting
|
|
||||||
if echo "$CUSTOM_NOTES" | grep -q "^\*\|^- \|http.*commit\|in #[0-9]\+"; then
|
|
||||||
# Already formatted, use as is
|
|
||||||
echo "$CUSTOM_NOTES" > "$NOTES_FILE"
|
|
||||||
else
|
|
||||||
# Add bullet point formatting
|
|
||||||
echo "- $CUSTOM_NOTES" > "$NOTES_FILE"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
||||||
echo "notes_file=$NOTES_FILE" >> $GITHUB_OUTPUT
|
echo "$NOTES" >> $GITHUB_OUTPUT
|
||||||
- name: Zip root-module directory
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
run: sh ./build-magisk-module.sh
|
- id: tag
|
||||||
- name: Delete release if exist then create release
|
run: echo "tag=nightly-${{ needs.build.outputs.short_sha }}" >> $GITHUB_OUTPUT
|
||||||
env:
|
- env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
gh release view "nightly" && gh release delete "nightly" -y --cleanup-tag
|
gh release create "${{ steps.tag.outputs.tag }}" \
|
||||||
gh release create "nightly" "./$APK_NAME" "./btl2capfix.zip" -p -t "Nightly Release" --notes-file "${{ steps.release-notes.outputs.notes_file }}" --generate-notes
|
artifacts/* \
|
||||||
|
-t "Nightly ${{ needs.build.outputs.short_sha }}" \
|
||||||
|
--notes "${{ steps.changelog.outputs.notes }}" \
|
||||||
|
--prerelease
|
||||||
|
|||||||
Reference in New Issue
Block a user