mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-29 09:33:04 +00:00
137 lines
3.8 KiB
YAML
137 lines
3.8 KiB
YAML
name: Android CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
paths:
|
|
- 'android/**'
|
|
pull_request:
|
|
paths:
|
|
- 'android/**'
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: Branch to build
|
|
required: true
|
|
default: main
|
|
workflow_call:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
short_sha: ${{ steps.vars.outputs.short_sha }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: zulu
|
|
java-version: 21
|
|
- uses: gradle/actions/setup-gradle@v4
|
|
- name: Decode keystore
|
|
run: echo "${{ secrets.RELEASE_KEYSTORE_FILE }}" | base64 --decode > android/release.keystore
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v3
|
|
- name: Accept Licenses
|
|
run: yes | sdkmanager --licenses
|
|
- name: Install NDK
|
|
run: sdkmanager "ndk;30.0.14904198"
|
|
- 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
|
|
- id: vars
|
|
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: apk-release
|
|
path: release/*release.apk
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: apk-debug
|
|
path: release/*debug.apk
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: root-module-release
|
|
path: release/*release.zip
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: root-module-debug
|
|
path: release/*debug.zip
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-bundle
|
|
path: release/*.aab
|
|
|
|
release:
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: apk-release
|
|
path: artifacts/apk-release
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: apk-debug
|
|
path: artifacts/apk-debug
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: root-module-release
|
|
path: artifacts/root-module-release
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: root-module-debug
|
|
path: artifacts/root-module-debug
|
|
|
|
- id: prev
|
|
run: |
|
|
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
|
|
- id: changelog
|
|
run: |
|
|
if [ -z "${{ steps.prev.outputs.tag }}" ]; then
|
|
NOTES=$(git log --pretty=format:"- %s (%h)")
|
|
else
|
|
NOTES=$(git log ${{ steps.prev.outputs.tag }}..HEAD --pretty=format:"- %s (%h)")
|
|
fi
|
|
echo "notes<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$NOTES" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- id: tag
|
|
run: echo "tag=nightly-${{ needs.build.outputs.short_sha }}" >> $GITHUB_OUTPUT
|
|
|
|
- env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh release create "${{ steps.tag.outputs.tag }}" \
|
|
artifacts/**/* \
|
|
-t "Nightly ${{ needs.build.outputs.short_sha }}" \
|
|
--notes "${{ steps.changelog.outputs.notes }}" \
|
|
--prerelease |