-
-
Notifications
You must be signed in to change notification settings - Fork 139
131 lines (111 loc) · 5.06 KB
/
dart.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Dart
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
build_android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
submodules: recursive
- uses: dart-lang/setup-dart@v1
with:
sdk: "3.4.0"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.0"
- uses: actions/setup-java@v1
with:
java-version: "17"
- name: setup credentials for namidaco
run: git config --global url.https://${{ secrets.PAT_ORG }}@github.com/namidaco/.insteadOf https://github.com/namidaco/
- name: setup credentials for MSOB7YY
run: git config --global url.https://${{ secrets.PAT }}@github.com/MSOB7YY/.insteadOf https://github.com/MSOB7YY/
- name: Git Submodule Update
run: git clone https://github.com/namidaco/namida-translations/ assets/language
- name: Setup dependencies
run: |
flutter clean
flutter pub get
flutter pub upgrade
- name: Extract version from pubspec.yaml
id: extract_version
run: |
VERSION=$(grep -o 'version:.*' pubspec.yaml | awk '{print $2}')
echo ::set-output name=version::"$VERSION"
- name: Create keystore & key.properties
run: |
echo ${{ secrets.ANDROID_SIGNING_KEYSTORE }} | base64 --decode > android/app/keystore.jks
echo ${{ secrets.ANDROID_SIGNING_KEY_PROPERTIES }} | base64 --decode > android/key.properties
- name: Creating original apks
continue-on-error: true
run: |
mkdir -p build_final
flutter build apk --target-platform android-arm64 --release
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build_final/namida-v${{ steps.extract_version.outputs.version}}-arm64-v8a.apk
flutter build apk --target-platform android-arm --release
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build_final/namida-v${{ steps.extract_version.outputs.version}}-armeabi-v7a.apk
- name: Creating clone repo & apks
run: |
git clone https://github.com/namidaco/namida/ namida-clone
cd namida-clone
flutter clean
flutter pub get
flutter pub upgrade
git clone https://github.com/namidaco/namida-translations/ assets/language
find ./ -type f -exec sed -i -e 's/com.msob7y.namida/com.msob7y.namida.snapshot/g' {} \;
echo ${{ secrets.ANDROID_SIGNING_KEYSTORE }} | base64 --decode > android/app/keystore.jks
echo ${{ secrets.ANDROID_SIGNING_KEY_PROPERTIES }} | base64 --decode > android/key.properties
mkdir -p ../build_final
flutter build apk --target-platform android-arm64 --release
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../build_final/namida-v${{ steps.extract_version.outputs.version}}-clone-arm64-v8a.apk
flutter build apk --target-platform android-arm --release
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../build_final/namida-v${{ steps.extract_version.outputs.version}}-clone-armeabi-v7a.apk
cd ../
- name: Get the previous release date
continue-on-error: true
run: |
release_info=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/namidaco/namida-snapshots/releases/latest)
release_date=$(echo "$release_info" | jq -r '.published_at')
echo "PREVIOUS_RELEASE_DATE=$release_date" >> $GITHUB_ENV
- name: Generate Changelog
continue-on-error: true
run: |
REPO_URL="https://github.com/namidaco/namida/commit/"
COMMITS=$(git log --pretty=format:"%H %s" --decorate --no-abbrev-commit --after="$PREVIOUS_RELEASE_DATE")
CHANGELOG=""
while IFS= read -r line; do
HASH=$(echo "$line" | awk '{print $1}')
MESSAGE=$(echo "$line" | cut -d' ' -f2-)
CHANGELOG="$CHANGELOG$REPO_URL$HASH $MESSAGE\n"
done <<< "$COMMITS"
# Encode special characters
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "CHANGELOG=$CHANGELOG" >> $GITHUB_ENV
- name: Creating Snapshot Release at namida-snapshots
uses: softprops/action-gh-release@v2
with:
repository: namidaco/namida-snapshots
make_latest: true
draft: false
tag_name: ${{ steps.extract_version.outputs.version}}
body: ${{ env.CHANGELOG}}
files: |
build_final/*
token: ${{ secrets.SNAPSHOTS_REPO_SECRET }}
- name: Upload all APKs
uses: actions/upload-artifact@v3
with:
name: all-apks
path: build_final/**