github actions fix (second try)

This commit is contained in:
sadorowo 2024-03-20 19:48:40 +01:00
parent 8eb65196cb
commit e347045ac8

View File

@ -1,50 +1,63 @@
name: Generate APK
env:
# The name of the main module repository
main_project_module: app
# The name of the main module repository
main_project_module: app
on:
push:
branches:
- 'develop'
push:
branches:
- 'develop'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
steps:
- uses: actions/checkout@v3
# Set Current Date As Env Variable
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# Set Current Date As Env Variable
- name: Set current date as env variable
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# Set Repository Name As Env Variable
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
# Set Repository Name As Env Variable
- name: Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'
- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Change wrapper permissions
run: chmod +x ./gradlew
# Create APK Release
- name: Build apk release project (APK) - ${{ env.main_project_module }} module
run: ./gradlew assemble
- name: Build Debug APK
run: ./gradlew assembleDebug
# Noted For Output [main_project_module]/build/outputs/apk/release/
- name: Upload APK Release - ${{ env.repository_name }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - APK(s) release generated
path: ${{ env.main_project_module }}/build/outputs/apk/release/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
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