-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 3.27 KB
/
Copy pathandroid.yml
File metadata and controls
92 lines (80 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Android CI
env:
# Module names for your project
app_module: app
# Project name
project_name: SmsGateway
on:
push:
branches:
- 'main'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 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
# Extract version from build.gradle.kts
- name: Extract version information
run: |
# SmsGateway version
APP_VERSION=$(grep -o 'versionName = "[^"]*"' ${{ env.app_module }}/build.gradle.kts | cut -d'"' -f2)
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
# Use server version for the release tag (you can modify this as needed)
echo "RELEASE_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
# App Build
- name: Build SmsGateway APK
run: |
chmod +x ./gradlew
./gradlew assembleDebug
./gradlew assembleRelease
# Upload SmsGateway Debug APK as artifact
- name: Upload SmsGateway APK Debug
uses: actions/upload-artifact@v4
with:
name: ${{ env.date_today }} - ${{ env.project_name }} - SmsGateway - Debug APK
path: ${{ env.app_module }}/build/outputs/apk/debug/
# Upload SmsGateway Release APK as artifact
- name: Upload SmsGateway APK Release
uses: actions/upload-artifact@v4
with:
name: ${{ env.date_today }} - ${{ env.project_name }} - SmsGateway - Release APK
path: ${{ env.app_module }}/build/outputs/apk/release/
# Rename APKs for easier identification
- name: Rename APKs
run: |
mkdir -p release_files
cp ${{ env.app_module }}/build/outputs/apk/debug/*.apk release_files/SmsGateway-App-${{ env.APP_VERSION }}-debug.apk
cp ${{ env.app_module }}/build/outputs/apk/release/*.apk release_files/SmsGateway-App-${{ env.APP_VERSION }}-release.apk
# Create GitHub Release
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.RELEASE_VERSION }}
name: Release v${{ env.RELEASE_VERSION }}
body: |
SmsGateway Release v${{ env.RELEASE_VERSION }} (${{ env.date_today }})
This release contains:
- SmsGateway APK v${{ env.APP_VERSION }} (Debug & Release)
Built automatically using GitHub Actions.
draft: false
prerelease: false
files: |
release_files/SmsGateway-App-${{ env.APP_VERSION }}-debug.apk
release_files/SmsGateway-App-${{ env.APP_VERSION }}-release.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}