All checks were successful
Build and release Android APK / build (push) Successful in 2m27s
68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: Build and release Android APK
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: android
|
|
timeout-minutes: 60
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://data.forgejo.org/actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Install the project Android and Gradle versions
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
sdkmanager "platforms;android-34" "build-tools;34.0.0"
|
|
curl -fsSLo /tmp/gradle.zip https://services.gradle.org/distributions/gradle-8.5-bin.zip
|
|
curl -fsSLo /tmp/gradle.zip.sha256 https://services.gradle.org/distributions/gradle-8.5-bin.zip.sha256
|
|
printf '%s %s\n' "$(cat /tmp/gradle.zip.sha256)" /tmp/gradle.zip | sha256sum -c -
|
|
unzip -q /tmp/gradle.zip -d /opt
|
|
|
|
- name: Build release APK
|
|
run: /opt/gradle-8.5/bin/gradle --no-daemon assembleRelease
|
|
|
|
- name: Stage versioned APK
|
|
id: version
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
count="$(git rev-list --count HEAD)"
|
|
short_sha="$(git rev-parse --short HEAD)"
|
|
date="$(date -u +'%Y.%m.%d')"
|
|
mkdir -p release
|
|
cp app/build/outputs/apk/release/app-release.apk "release/YourVPNDead-v${count}.apk"
|
|
(cd release && sha256sum *.apk > SHA256SUMS)
|
|
printf 'count=%s\nsha=%s\ndate=%s\n' "$count" "$short_sha" "$date" >> "$FORGEJO_OUTPUT"
|
|
|
|
- name: Upload build proof
|
|
uses: https://data.forgejo.org/forgejo/upload-artifact@v4
|
|
with:
|
|
name: YourVPNDead
|
|
path: release/
|
|
if-no-files-found: error
|
|
retention-days: 90
|
|
|
|
- name: Publish Forgejo release
|
|
if: forgejo.event_name == 'push' && forgejo.ref == 'refs/heads/main'
|
|
uses: https://data.forgejo.org/actions/forgejo-release@v2.13.4
|
|
with:
|
|
direction: upload
|
|
tag: v${{ steps.version.outputs.count }}
|
|
title: YourVPNDead v${{ steps.version.outputs.count }} (${{ steps.version.outputs.date }})
|
|
release-dir: release
|
|
release-notes: |
|
|
Автоматическая Android-сборка из коммита ${{ steps.version.outputs.sha }}.
|
|
override: true
|