Skip to content
This repository was archived by the owner on Nov 11, 2023. It is now read-only.

Commit 1d540ff

Browse files
committed
add ci
1 parent 3090bb5 commit 1d540ff

2 files changed

Lines changed: 183 additions & 0 deletions

File tree

.github/workflows/android.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Android CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
paths:
8+
- "puppet/**"
9+
branches: [ "main" ]
10+
workflow_dispatch:
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: puppet
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: set up JDK 17
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
cache: gradle
26+
27+
- name: Install Git LFS
28+
run: sudo apt-get install git-lfs
29+
- name: Set up Git LFS
30+
run: git lfs install
31+
- name: Pull LFS Objects
32+
run: git lfs pull
33+
34+
- name: Create file
35+
run: cat /home/runner/work/puppet/puppet/puppet/app/google-services.json | base64
36+
37+
- name: Putting data
38+
env:
39+
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
40+
run: echo $DATA > /home/runner/work/puppet/puppet/puppet/app/google-services.json
41+
42+
- name: Grant execute permission for gradlew
43+
run: chmod +x gradlew
44+
# Run Tests Build
45+
- name: Run gradle tests
46+
run: ./gradlew test
47+
48+
- name: Build with Gradle
49+
run: ./gradlew build
50+
51+
- name: Archive lint results
52+
if: always()
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: lint-report
56+
path: app/build/reports/lint-results-debug.html

.github/workflows/release_ci.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Release All CI
2+
env:
3+
main_project_module: app
4+
on:
5+
push:
6+
paths:
7+
- "puppet/**"
8+
tags:
9+
- '*'
10+
workflow_dispatch:
11+
jobs:
12+
build-android:
13+
permissions: write-all
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: puppet
18+
steps:
19+
- uses: actions/checkout@v3
20+
# Set Current Date As Env Variable
21+
- name: Set current date as env variable
22+
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
23+
24+
# Set Repository Name As Env Variable
25+
- name: Set repository name as env variable
26+
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
27+
28+
- name: set up JDK 17
29+
uses: actions/setup-java@v3
30+
with:
31+
java-version: '17'
32+
distribution: 'temurin'
33+
cache: gradle
34+
35+
- name: Create file
36+
run: cat /home/runner/work/puppet/puppet/puppet/app/google-services.json | base64
37+
38+
- name: Putting data
39+
env:
40+
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
41+
run: echo $DATA > /home/runner/work/puppet/puppet/puppet/app/google-services.json
42+
43+
- name: Grant execute permission for gradlew
44+
run: chmod +x gradlew
45+
46+
# Run Tests Build
47+
- name: Run gradle tests
48+
run: ./gradlew test
49+
50+
- name: Build with Gradle
51+
run: ./gradlew build
52+
53+
- name: Archive lint results
54+
if: always()
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: lint-report
58+
path: app/build/reports/lint-results-debug.html
59+
60+
# Create APK Debug
61+
- name: Build apk debug project (APK) - ${{ env.main_project_module }} module
62+
run: ./gradlew assembleDebug
63+
64+
# Create APK Release
65+
- name: Build apk release project (APK) - ${{ env.main_project_module }} module
66+
run: ./gradlew assemble
67+
68+
# Create Bundle AAB Release
69+
# Noted for main module build [main_project_module]:bundleRelease
70+
- name: Build app bundle release (AAB) - ${{ env.main_project_module }} module
71+
run: ./gradlew ${{ env.main_project_module }}:bundleRelease
72+
73+
# Upload Artifact Build
74+
# Noted For Output [main_project_module]/build/outputs/apk/debug/
75+
- name: Upload APK Debug - ${{ env.repository_name }}
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: android-debug
79+
path: puppet/${{ env.main_project_module }}/build/outputs/apk/debug/
80+
81+
# Noted For Output [main_project_module]/build/outputs/apk/release/
82+
- name: Upload APK Release - ${{ env.repository_name }}
83+
uses: actions/upload-artifact@v2
84+
with:
85+
name: android-release
86+
path: puppet/${{ env.main_project_module }}/build/outputs/apk/release/
87+
88+
# Noted For Output [main_project_module]/build/outputs/bundle/release/
89+
- name: Upload AAB (App Bundle) Release - ${{ env.repository_name }}
90+
uses: actions/upload-artifact@v2
91+
with:
92+
name: android-bundle
93+
path: puppet/${{ env.main_project_module }}/build/outputs/bundle/release/
94+
95+
release:
96+
needs: [build-android]
97+
permissions: write-all
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Download All Artifacts
101+
uses: actions/download-artifact@v3
102+
with:
103+
path: ./
104+
105+
- name: Display structure of downloaded files
106+
run: ls -R
107+
108+
- name: Create Release
109+
id: create_release
110+
uses: actions/create-release@v1
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
with:
114+
tag_name: ${{ github.ref }}
115+
release_name: Release ${{ github.ref }}
116+
draft: false
117+
prerelease: false
118+
119+
- name: Upload Android Release
120+
uses: actions/upload-release-asset@v1
121+
env:
122+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
with:
124+
upload_url: ${{ steps.create_release.outputs.upload_url }}
125+
asset_path: android-debug/app-debug.apk # Update this with the correct APK path
126+
asset_name: app-release-unsigned.apk
127+
asset_content_type: application/vnd.android.package-archive

0 commit comments

Comments
 (0)