53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
name: Build Android APK
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup JDK
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
|
|
- name: Setup Android SDK
|
|
uses: android-actions/setup-android@v2
|
|
|
|
- name: Build with Gradle
|
|
run: |
|
|
chmod +x ./gradlew
|
|
./gradlew assembleRelease --no-daemon
|
|
|
|
- name: Upload APK
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: apk
|
|
path: app/build/outputs/apk/release/*.apk
|
|
|
|
- name: Create Release
|
|
run: |
|
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
|
APK_FILE=$(ls app/build/outputs/apk/release/*.apk | head -1)
|
|
|
|
# Create release via API
|
|
curl -X POST "https://git-dangilcal.duckdns.org/api/v1/repos/dangilcal/Helldivers-app-movil/releases" \
|
|
-H "accept: application/json" \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"Release $TAG_NAME\", \"draft\": false, \"prerelease\": false}"
|
|
|
|
# Upload asset
|
|
curl -X POST "https://git-dangilcal.duckdns.org/api/v1/repos/dangilcal/Helldivers-app-movil/releases/tags/$TAG_NAME/assets" \
|
|
-H "accept: application/json" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-F "attachment=@$APK_FILE"
|