-
Notifications
You must be signed in to change notification settings - Fork 27
137 lines (118 loc) · 4.03 KB
/
android-weekly.yml
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
129
130
131
132
133
134
135
136
137
name: APM Android dev Build
on:
schedule:
- cron: '0 0 * * 1'
push:
branches:
- 'dev'
- 'dev-newarch'
workflow_dispatch:
jobs:
checkLastCommit:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v4
- name: print latest_commit
run: echo ${{ github.sha }}
- name: Get Last Commit Date
id: commit_date
run: |
LAST_COMMIT_DATE=$(git log -1 --format=%ct)
echo "LAST_COMMIT_DATE=${LAST_COMMIT_DATE}" >> $GITHUB_ENV
- name: Calculate Time Difference
id: time_diff
run: |
CURRENT_DATE=$(date +%s)
SECONDS_IN_WEEK=$((60*60*24*7))
TIME_DIFF=$((CURRENT_DATE - LAST_COMMIT_DATE))
echo "TIME_DIFF=${TIME_DIFF}" >> $GITHUB_ENV
- name: Check Last Commit
run: |
if [[ $TIME_DIFF -gt $((60*60*24*7)) ]]; then
echo "Last commit is older than a week."
echo "is_old_commit=true" >> $GITHUB_OUTPUT
else
echo "Last commit is within the past week."
echo "is_old_commit=false" >> $GITHUB_OUTPUT
fi
build:
name: Build
runs-on: ubuntu-latest
needs: checkLastCommit
if: ${{ needs.checkLastCommit.outputs.is_old_commit == false }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false
- name: Get branch name
run: |
# Short name for current branch. For PRs, use target branch (base ref)
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: set up JDK 18
uses: actions/setup-java@v4
with:
java-version: 18
distribution: temurin
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Yarn
uses: threeal/[email protected]
- name: 'Create env file'
run: |
echo "${{ secrets.ENV_FILE }}" > .env
echo "${{ secrets.SENTRY_PROPERTIES }}" > ./android/sentry.properties
- name: alias yarn.cmd to yarn
run: alias yarn.cmd="yarn"
- name: Add Build Sign Keys
run: |
git submodule update --init --recursive
echo "${{ secrets.RELEASE_SIGN_PWD }}" >> ./android/gradle.properties
- name: python fixHTTP
run: |
python ./scripts/fixHTTP.py
python ./scripts/dev_cleartext.py
python ./scripts/release_bump.py --dev
- name: Build Sign jks
id: write_file
uses: timheuer/[email protected]
with:
fileName: 'noxupload.jks'
fileDir: './android/app'
encodedString: ${{ secrets.SIGNED_KEY_BASE64 }}
- name: Install dependencies
run: yarn install; yarn postinstall
- name: clean generated builds
run: rm -rf android/app/build/generated/
- name: gradle build
run: cd android && chmod +x gradlew && ./gradlew assembleRelease
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.GIT_BRANCH }}-build-${{ steps.date.outputs.date }}
files: android/app/build/outputs/apk/release/app-arm64-v8a-release.apk
prerelease: true
target_commitish: ${{ env.GIT_BRANCH }}