mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-19 12:28:53 +01:00
clean up gh actions
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
name: Build and Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
apk:
|
||||
name: Generate APK
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: Set execution flag for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Decode Keystore File
|
||||
run: echo "${{ secrets.KEYSTORE_FILE }}" | base64 -d > ${{ github.workspace }}/my-release-key.keystore
|
||||
|
||||
- name: List files in the APK directory
|
||||
run: ls -Rla ./
|
||||
|
||||
- name: Bump MINOR version in build.gradle (features update)
|
||||
working-directory: presentation
|
||||
run: |
|
||||
# Extract current versionName and versionCode
|
||||
VERSION_LINE=$(grep "versionName" build.gradle)
|
||||
VERSION_NAME=$(echo "$VERSION_LINE" | sed -n "s/.*versionName[ ]*['\"]\([^'\"]*\)['\"].*/\1/p")
|
||||
VERSION_CODE=$(grep "versionCode" build.gradle | awk '{print $2}')
|
||||
|
||||
# Error handling for version parsing
|
||||
if [[ ! "$VERSION_NAME" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Error: versionName is not in MAJOR.MINOR.PATCH format: $VERSION_NAME"
|
||||
exit 1
|
||||
fi
|
||||
if ! [[ "$VERSION_CODE" =~ ^[0-9]+$ ]]; then
|
||||
echo "Error: versionCode is not an integer: $VERSION_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Split versionName into major, minor, patch
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION_NAME"
|
||||
# Bump minor version, reset patch to 0
|
||||
MINOR=$((MINOR + 1))
|
||||
PATCH=0
|
||||
NEW_VERSION_NAME="$MAJOR.$MINOR.$PATCH"
|
||||
NEW_VERSION_CODE=$((VERSION_CODE + 1))
|
||||
|
||||
# Update build.gradle in-place
|
||||
sed -i "s/versionName.*/versionName '$NEW_VERSION_NAME'/" build.gradle
|
||||
sed -i "s/versionCode.*/versionCode $NEW_VERSION_CODE/" build.gradle
|
||||
|
||||
echo "Bumped version to $NEW_VERSION_NAME ($NEW_VERSION_CODE)"
|
||||
|
||||
- name: Build APK
|
||||
run: |
|
||||
./gradlew assembleRelease \
|
||||
-Pandroid.injected.signing.store.file=${{ github.workspace }}/my-release-key.keystore \
|
||||
-Pandroid.injected.signing.store.password=${{ secrets.KEYSTORE_PASSWORD }} \
|
||||
-Pandroid.injected.signing.key.alias=${{ secrets.KEY_ALIAS }} \
|
||||
-Pandroid.injected.signing.key.password=${{ secrets.KEY_PASSWORD }} \
|
||||
--stacktrace
|
||||
|
||||
- name: Rename APK
|
||||
run: mv presentation/build/outputs/apk/release/QUIK-v*-release.apk presentation/build/outputs/apk/release/QUIK-release.apk
|
||||
|
||||
- name: Upload APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: apk
|
||||
path: presentation/build/outputs/apk/release/QUIK-release.apk
|
||||
|
||||
release:
|
||||
name: Release APK
|
||||
needs: apk
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set release datetime
|
||||
run: echo "DATETIME=$(date +'%d-%m-%y_%s')" >> $GITHUB_ENV
|
||||
|
||||
- name: Create and push tag
|
||||
run: |
|
||||
git config --global user.name "github-actions"
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git tag "v${{ env.DATETIME }}"
|
||||
git push origin "v${{ env.DATETIME }}"
|
||||
|
||||
- name: Download APK from build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: apk*
|
||||
|
||||
- name: List files in the APK directory
|
||||
run: ls -Rla ./
|
||||
|
||||
- name: Create and upload release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
prerelease: true
|
||||
tag_name: "v${{ env.DATETIME }}"
|
||||
files: QUIK-release.apk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Validate Fastlane Supply Metadata
|
||||
uses: ashutoshgngwr/validate-fastlane-supply-metadata@v2.0.0
|
||||
with:
|
||||
fastlaneDir: ./metadata
|
||||
Reference in New Issue
Block a user