wulkanowy-mod/.github/workflows/android.yml

66 lines
2.1 KiB
YAML
Raw Normal View History

2024-03-01 02:18:08 -06:00
name: Generate APK
env:
2024-03-20 13:48:40 -05:00
# The name of the main module repository
main_project_module: app
2024-03-01 02:18:08 -06:00
2024-02-29 08:57:28 -06:00
on:
2024-03-20 13:48:40 -05:00
push:
branches:
- 'develop'
2024-03-01 02:18:08 -06:00
2024-03-20 13:48:40 -05:00
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
2024-02-29 08:57:28 -06:00
jobs:
2024-03-20 13:48:40 -05:00
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
2024-03-20 14:03:00 -05:00
- name: Set up JDK
2024-03-20 13:48:40 -05:00
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'
2024-03-20 14:03:00 -05:00
- name: Get app version
id: get_version
2024-03-20 14:05:59 -05:00
run: echo ::set-output name=version_name::$(grep -m1 "versionName" app/build.gradle | awk '{print $2}' | tr -d \''"\')
2024-03-20 14:03:00 -05:00
2024-03-20 13:48:40 -05:00
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2024-03-20 14:03:00 -05:00
tag_name: v${{ steps.get_version.outputs.version_name }}
2024-03-20 13:48:40 -05:00
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Debug APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/debug/*.apk
asset_name: debug-${{ env.repository_name }}-${{ env.date_today }}.apk
asset_content_type: application/vnd.android.package-archive