-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (114 loc) · 4.24 KB
/
release_feature_github.yaml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Release Build
on:
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Android project
uses: actions/checkout@v3
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'corretto'
cache: gradle
- name: Setup Gradle Cache
uses: gradle/gradle-build-action@v3
with:
gradle-home-cache-cleanup: true
- name: Configure Keystore
run: |
echo "$ANDROID_KEYSTORE_FILE" > app/keystore.jks.b64
base64 -d -i app/keystore.jks.b64 > app/keystore.jks
echo "keystoreFile=keystore.jks" >> signing.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> signing.properties
echo "keystorePassword=$KEYSTORE_STORE_PASSWORD" >> signing.properties
echo "::debug::storePassword=$KEYSTORE_STORE_PASSWORD"
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> signing.properties
env:
ANDROID_KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease bundleRelease
- name: Get AAB file path
id: aab-path
run: |
# Find the AAB file, accounting for potential variations in the filename.
aab_file=$(find . -name '*.aab' -type f -path "*build/outputs/bundle/release/*" | head -1)
echo "aab_file=${aab_file}" >> $GITHUB_OUTPUT
- name: Get APK file path
id: apk-path
run: |
# Find the APK file, accounting for potential variations in the filename.
apk_file=$(find . -name '*.apk' -type f -path "*build/outputs/apk/release/*" | head -1)
echo "apk_file=${apk_file}" >> $GITHUB_OUTPUT
- name: Upload AAB file to Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ steps.aab-path.outputs.aab_file }}
- name: Upload APK file to Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ steps.apk-path.outputs.apk_file }}
- name: Build Changelog
uses: ardalanamini/auto-changelog@v4
id: changelog
with:
github-token: ${{ github.token }}
commit-types: |
feat: New Features
fix: Bug Fixes
build: Build System & Dependencies
perf: Performance Improvements
docs: Documentation
test: Tests
refactor: Refactors
chore: Chores
ci: CI
style: Code Style
revert: Reverts
default-commit-type: Other Changes
release-name: v1.0.0
release-name-prefix: ""
mention-authors: true
mention-new-contributors: true
include-compare-link: true
include-pr-links: true
include-commit-links: true
semver: true
use-github-autolink: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.apk-path.outputs.apk_file }}
asset_name: app-release-signed-${{ github.ref }}.apk
asset_content_type: application/zip
- name: Upload AAB
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.aab-path.outputs.aab_file }}
asset_name: app-release-signed-${{ github.ref }}.aab
asset_content_type: application/zip