Update CI/CD

This commit is contained in:
Anthonyy232 committed 2025-08-28 10:53:11 -07:00
1 parent 04d0c57cb0
commit b3fb2b82f2
2 files changed
+66 -31

No files matched your search

+52 -24
View File
@@ -1,36 +1,64 @@
# This is a basic workflow to help you get started with Actions
name: Build APK and Create Release on Tag
name: CI
# Controls when the workflow will run
# This workflow runs on two conditions:
# 1. A push to the 'main' branch.
# 2. A push of a new tag that starts with 'v' (e.g., v1.0, v3.1.2).
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
branches: [ "main" ]
tags: [ 'v*' ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# 1. Check out the repository code
- name: Checkout code
uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
# 2. Set up JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
# Runs a set of commands using the runners shell
- name: Run a multi-line script
# 3. Make the Gradle wrapper executable
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# 4. Decode the Base64 keystore
- name: Decode Keystore
env:
SIGNING_KEYSTORE_BASE64: ${{ secrets.SIGNING_KEYSTORE_BASE64 }}
run: |
echo Add other actions to build,
echo test, and deploy your project.
echo $SIGNING_KEYSTORE_BASE64 | base64 --decode > ${{ github.workspace }}/keystore.jks
# 5. Build the signed APK (This step runs for both main and tag pushes)
- name: Build Release APK
env:
SIGNING_KEYSTORE_PATH: ${{ github.workspace }}/keystore.jks
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: ./gradlew assembleRelease
# 6. Upload APK as a temporary artifact (ONLY for pushes to the main branch)
- name: Upload APK as Artifact (for main branch)
if: startsWith(github.ref, 'refs/heads/main')
uses: actions/upload-artifact@v4
with:
name: signed-apk
path: app/build/outputs/apk/release/paperize-v*.apk
if-no-files-found: warn
# 7. Create a Draft GitHub Release (ONLY for pushes of a new tag)
- name: Create Draft Release (for tags)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: app/build/outputs/apk/release/paperize-v*.apk
draft: true # This creates a draft release, it is not published
generate_release_notes: true # Automatically creates release notes from commits