Skip to content

Commit a706fd0

Browse files
Merge pull request #636 from fmidev/feature/635-pipeline-for-main-branch
issue-635: The latest build from main branch
2 parents 1192a7a + f6ba97f commit a706fd0

File tree

3 files changed

+218
-13
lines changed

3 files changed

+218
-13
lines changed

.github/workflows/latest.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# This is workflow to build Android app for testing
2+
3+
name: The latest Android build from main-branch
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "main" branch
8+
push:
9+
branches: [ "main" ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
# Build job needs test !
16+
jobs:
17+
18+
# Run React Native Eslint and Jest tests
19+
test:
20+
if: ${{ false }}
21+
name: Test
22+
# Setup Ubuntu version
23+
runs-on: ubuntu-latest
24+
strategy:
25+
# Node version matrix
26+
matrix:
27+
node-version: [20.11.1]
28+
# Steps
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Use Node.js ${{ matrix.node-version }}
32+
# Setup node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
cache: 'yarn'
37+
# Install dependencies
38+
- name: Install dependencies
39+
run: yarn install
40+
# Get defaultConfig
41+
- name: Get defaultConfig
42+
env:
43+
defaultConfig: ${{ secrets.DEFAULTCONFIG }}
44+
shell: bash
45+
run: |
46+
touch defaultConfig.ts
47+
echo "$defaultConfig" >> defaultConfig.ts
48+
49+
# Run lint -tests
50+
- name: Run Eslint tests
51+
if: ${{ false }}
52+
run: yarn lint --fix
53+
# Run Jest -tests
54+
- name: Run Jest tests
55+
if: ${{ false }}
56+
run: yarn test
57+
58+
# Decode, Build and sign Android application
59+
build:
60+
# needs: test
61+
name: Android-build
62+
# Set Ubuntu version
63+
runs-on: ubuntu-latest
64+
# Node version matrix
65+
strategy:
66+
matrix:
67+
node-version: [20.11.1]
68+
# Steps
69+
steps:
70+
- name: Checkout to git repository
71+
uses: actions/checkout@v4
72+
# Setup Node
73+
- uses: actions/setup-node@v4
74+
with:
75+
node-version: ${{ matrix.node-version }}
76+
cache: 'yarn'
77+
- name: Install dependencies
78+
run: |
79+
yarn install
80+
81+
# Get defaultConfig
82+
- name: Get defaultConfig
83+
env:
84+
defaultConfig: ${{ secrets.DEFAULTCONFIG }}
85+
shell: bash
86+
run: |
87+
touch defaultConfig.ts
88+
echo "$defaultConfig" >> defaultConfig.ts
89+
90+
# Set up Java 17
91+
- name: Set up Java 17
92+
uses: actions/setup-java@v3
93+
with:
94+
java-version: '17'
95+
distribution: 'temurin' # You can use 'adopt', 'zulu', or another distribution if needed
96+
97+
# Install Ruby
98+
- name: Install Ruby
99+
uses: ruby/setup-ruby@v1
100+
with:
101+
ruby-version: '3.3.0'
102+
103+
# Update bundler
104+
- name: Update bundler
105+
run: bundle update --bundler
106+
working-directory: android
107+
108+
# Bundle install
109+
- name: Bundle install
110+
run: gem install bundler && bundle install
111+
working-directory: android
112+
113+
# Decode upload keystore
114+
- name: Decode Keystore File
115+
uses: timheuer/base64-to-file@v1
116+
id: android_keystore
117+
with:
118+
fileName: "android_keystore.keystore"
119+
encodedString: ${{ secrets.KEYSTORE }}
120+
121+
# Build and sign
122+
- name: Build
123+
env:
124+
KEYSTORE: ${{ steps.android_keystore.outputs.filePath }}
125+
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
126+
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
127+
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
128+
# SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
129+
run: |
130+
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" > .env
131+
chmod +x ./gradlew
132+
bundle exec fastlane android build_apk
133+
working-directory: android
134+
135+
- name: Rename APK
136+
run:
137+
mv "./app/build/outputs/apk/release/app-release.apk" "./app/build/outputs/apk/release/latest.apk"
138+
working-directory: android
139+
140+
# Upload artifact
141+
- name: Upload build artifacts
142+
uses: actions/upload-artifact@v4
143+
with:
144+
name: latest.apk
145+
path: |
146+
${{ github.workspace }}/android/app/build/outputs/apk/release/latest.apk
147+
retention-days: 7
148+
overwrite: true

android/fastlane/Fastfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ platform :android do
5656
push_to_git_remote if should_push
5757
end
5858
end
59+
60+
# Build APK only
61+
desc "Android build APK"
62+
lane :build_apk do
63+
# Gradle clean
64+
gradle(task: 'clean', project_dir: './')
65+
# Gradle sign aab -file
66+
gradle(task: 'assemble', build_type: "Release", project_dir: './',properties: {
67+
"android.injected.signing.store.file" => ENV["KEYSTORE"],
68+
"android.injected.signing.store.password" => ENV["SIGNING_STORE_PASSWORD"],
69+
"android.injected.signing.key.alias" => ENV["SIGNING_KEY_ALIAS"],
70+
"android.injected.signing.key.password" => ENV["SIGNING_KEY_PASSWORD"]
71+
})
72+
end
5973

6074
# Sign, build and deploy to Google Play Store
6175
desc "Sign, build, and deploy to Google Play Store"
@@ -91,7 +105,7 @@ platform :android do
91105
"android.injected.signing.key.password" => ENV["SIGNING_KEY_PASSWORD"]
92106
})
93107
end
94-
108+
95109
# Deploy to Google Play Store
96110
desc "Deploy a new version to the Google Play"
97111
lane :deploy do

android/fastlane/README.md

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,72 @@
11
fastlane documentation
2-
================
2+
----
3+
34
# Installation
45

56
Make sure you have the latest version of the Xcode command line tools installed:
67

7-
```
8+
```sh
89
xcode-select --install
910
```
1011

11-
Install _fastlane_ using
12-
```
13-
[sudo] gem install fastlane -NV
14-
```
15-
or alternatively using `brew install fastlane`
12+
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
1613

1714
# Available Actions
15+
1816
## Android
19-
### android increment_version
20-
```
21-
fastlane android increment_version
17+
18+
### android increment_android_version
19+
20+
```sh
21+
[bundle exec] fastlane android increment_android_version
2222
```
23+
2324
Increment build and version number and push to repository - Build number = version code, version number = version name
2425

26+
### android build_apk
27+
28+
```sh
29+
[bundle exec] fastlane android build_apk
30+
```
31+
32+
Android build APK
33+
34+
### android build_sign_and_deploy
35+
36+
```sh
37+
[bundle exec] fastlane android build_sign_and_deploy
38+
```
39+
40+
Sign, build, and deploy to Google Play Store
41+
42+
### android get_version_code_and_version_name
43+
44+
```sh
45+
[bundle exec] fastlane android get_version_code_and_version_name
46+
```
47+
48+
Get version code and version name
49+
50+
### android build_and_sign
51+
52+
```sh
53+
[bundle exec] fastlane android build_and_sign
54+
```
55+
56+
Release for the Android beta
57+
58+
### android deploy
59+
60+
```sh
61+
[bundle exec] fastlane android deploy
62+
```
63+
64+
Deploy a new version to the Google Play
65+
2566
----
2667

2768
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
28-
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
29-
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
69+
70+
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
71+
72+
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

0 commit comments

Comments
 (0)