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