Skip to content

Commit

Permalink
Create build-noti.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
itsnotsos authored Sep 29, 2024
0 parents commit 5533bfc
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/build-noti.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: APK Builder

on:
workflow_dispatch:

jobs:
apk:
name: Generate APK
runs-on: ubuntu-latest
steps:
- name: Checkout REPO
uses: actions/checkout@v4
with:
repository: Burhanverse/Noti

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Setup Keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
echo "storePassword=$KEYSTORE_PASSWORD" >> keystore.properties
echo "keyAlias=$KEY_ALIAS" >> keystore.properties
echo "keyPassword=$KEY_PASSWORD" >> keystore.properties
echo "storeFile=${{ github.workspace }}/key.jks" >> keystore.properties
echo "$KEYSTORE" | base64 --decode > "${{ github.workspace }}/key.jks"
- name: Extract repository name
id: extract_repo_name
run: echo "REPO_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV

- name: Build Release APK
run: |
./gradlew assembleRelease \
-PKEYSTORE_FILE=${{ github.workspace }}/key.jks \
-PKEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} \
-PKEY_ALIAS=${{ secrets.KEY_ALIAS }} \
-PKEY_PASSWORD=${{ secrets.KEY_PASSWORD }} --stacktrace
mv ./app/build/outputs/apk/release/app-release.apk "./${{ env.REPO_NAME }}.apk"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.REPO_NAME }}.apk
path: ./${{ env.REPO_NAME }}.apk

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
tag_name: ${{ github.run_number }}
release_name: Release ${{ github.run_number }}

- name: Upload Release APK
id: upload_release_asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.REPO_NAME }}.apk
asset_name: ${{ env.REPO_NAME }}.apk
asset_content_type: application/vnd.android.package-archive

0 comments on commit 5533bfc

Please sign in to comment.