Skip to content

Commit c16752f

Browse files
Add GitHub Actions
1 parent a830ce3 commit c16752f

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+'
7+
8+
jobs:
9+
release:
10+
name: Publish on Google Play
11+
runs-on: [ self-hosted, macOS ]
12+
needs: [ cancel-workflow ]
13+
timeout-minutes: 45
14+
env:
15+
BUILD_NUMBER: ${{ github.run_number }}
16+
17+
steps:
18+
# Checkout - https://github.com/actions/checkout
19+
- name: Checkout
20+
uses: actions/[email protected]
21+
22+
# Setup Java - https://github.com/actions/setup-java
23+
- name: Set up JDK 21
24+
uses: actions/[email protected]
25+
with:
26+
distribution: 'temurin'
27+
java-version: '21'
28+
- name: Check JDK version
29+
run: java -version
30+
31+
# Setup Android - https://github.com/android-actions/setup-android
32+
- name: Setup Android SDK
33+
uses: android-actions/[email protected]
34+
35+
# Decode Keystore
36+
- name: Decode Keystore
37+
env:
38+
RELEASE_KEYSTORE_BASE64: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
39+
40+
run: |
41+
echo RELEASE_KEYSTORE_BASE64 > release.txt
42+
base64 -d release.txt > secrets/release.jks
43+
44+
# Build and deploy - https://github.com/gradle/gradle-build-action
45+
- name: Build and Publish App on Google Play
46+
uses: gradle/actions/[email protected]
47+
env:
48+
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
49+
RELEASE_KEY_PASS: ${{ secrets.RELEASE_KEY_PASS }}
50+
with:
51+
gradle-version: wrapper
52+
arguments: publishProdReleaseBundle --stacktrace
53+
54+
# Create GitHub release - https://github.com/softprops/action-gh-release
55+
- name: GitHub Release
56+
uses: softprops/[email protected]
57+
with:
58+
name: Twilight ${{ env.GITHUB_REF_NAME }}
59+
60+
# Set VERSION_INFORMATION
61+
- run: echo "VERSION_INFORMATION=$(${{github.workspace}}/gradlew -q printVersionInformation)" >> $GITHUB_ENV
62+
continue-on-error: true

composeApp/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ android {
9393
sourceSets["main"].res.srcDirs("src/androidMain/res")
9494
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
9595

96+
signingConfigs {
97+
create("release") {
98+
storeFile = file("secrets/release.jks")
99+
storePassword = System.getenv("RELEASE_KEY_PASS")
100+
keyAlias = System.getenv("RELEASE_KEY_ALIAS")
101+
keyPassword = System.getenv("RELEASE_KEY_PASS")
102+
}
103+
}
104+
96105
defaultConfig {
97106
applicationId = "com.delacrixmorgan.twilight.android"
98107
minSdk = libs.versions.android.minSdk.get().toInt()
@@ -120,6 +129,7 @@ android {
120129
buildFeatures {
121130
buildConfig = true
122131
}
132+
123133
dependencies {
124134
debugImplementation(libs.compose.ui.tooling)
125135
}

0 commit comments

Comments
 (0)