-
Notifications
You must be signed in to change notification settings - Fork 3
166 lines (156 loc) · 5.44 KB
/
nightly.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Nightly
on:
schedule:
- cron: '0 4 * * *'
repository_dispatch:
types: nightly
workflow_dispatch:
jobs:
check-build-needed:
runs-on: ubuntu-latest
outputs:
build_nightly: ${{ steps.check.outputs.build_nightly }}
steps:
- uses: actions/checkout@v4
- id: check
run: |
git fetch --depth=1 --no-tags origin +refs/tags/nightly:refs/tags/nightly
[ "$GITHUB_EVENT_NAME" != "schedule" -o "$(git show-ref -s --head HEAD)" != "$(git show-ref -s nightly)" ] && echo build_nightly=true >> $GITHUB_OUTPUT
exit 0
build-android:
needs: check-build-needed
if: ${{ needs.check-build-needed.outputs.build_nightly == 'true' }}
runs-on: ubuntu-latest
environment: release-build
container:
image: cimg/android:2023.11-node
options: -u root
env:
KEYSTORE_PATH: ${{ github.workspace }}/insporation.jks
steps:
- name: "Install SDK 33"
run: sdkmanager "build-tools;33.0.0"
- uses: actions/checkout@v4
with:
ref: main # Ensure translations update is included
- uses: subosito/flutter-action@v2
id: flutter-action
with:
flutter-version: '3.16.x'
- name: Workaround flutter directory permissions
run: |-
git config --global --add safe.directory ${{ steps.flutter-action.outputs.CACHE-PATH }}
git config --global --add safe.directory $(pwd)
- name: Setup keystore
run: |
echo "$KEYSTORE" | base64 -d > "$KEYSTORE_PATH"
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
- name: Build
run: |
flutter build apk --release --build-number=$GITHUB_RUN_NUMBER
mkdir -p dist
cp build/app/outputs/apk/release/app-release.apk dist/insporation-nightly-$(git describe --tags 2>/dev/null || echo $GITHUB_RUN_NUMBER).apk
git rev-parse main > dist/BUILD_SHA
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_KEY_ALIAS: key
- uses: actions/upload-artifact@v1
with:
name: Android Application bundles
path: dist
publish-android:
needs: build-android
runs-on: ubuntu-latest
environment: release-build
container:
image: registry.gitlab.com/fdroid/docker-executable-fdroidserver
options: -u root
env:
KEYSTORE_PATH: ${{ github.workspace }}/insporation.jks
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- uses: actions/download-artifact@v1
with:
name: Android Application bundles
path: dist
- id: build_sha
run: echo "::set-output name=BUILD_SHA::$(cat dist/BUILD_SHA)"
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: nightly
env:
GITHUB_SHA: ${{ steps.build_sha.outputs.BUILD_SHA }} # Ensure translations update is included
- uses: AButler/[email protected]
with:
files: 'dist/*'
release-tag: nightly
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout F-Droid repository
uses: actions/checkout@v4
with:
ref: gh-pages
path: pages
- name: Setup keystore
run: |
echo "$KEYSTORE" | base64 -d > "$KEYSTORE_PATH"
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
- name: Update F-Droid repository
run: |
cd pages
git config --local user.email "[email protected]"
git config --local user.name "Github Actions Nightly Job"
# Truncate history
git checkout --orphan new-pages
git commit -m "Import previous state"
cd fdroid
# Add new build
cp ../../dist/*.apk repo/
# Cleanup archive
find archive -name '*.apk' | sort -V | head -n-2 | xargs -r rm
# Rebuild repos
fdroid update
# Cleanup icons
for icon in {repo,archive}/icons/*.*.png; do
repo="$(dirname "$(dirname "$icon")")"
base="$(basename "$icon" .png)"
build="$(echo "$base" | tr -Cd '0-9')"
if [ ! -e "$repo/insporation-nightly-$build.apk" ]; then
rm $repo/icons*/$base.{png,xml} || echo "No icons for $repo/$base.apk present"
fi
done
# Publish
git add .
git commit -m "Update fdroid repository for nightly build $GITHUB_RUN_NUMBER"
git push -f "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" new-pages:gh-pages
shell: bash --noprofile --norc -Beo pipefail +f {0}
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_KEY_ALIAS: key
publish-ios:
needs: check-build-needed
if: ${{ needs.check-build-needed.outputs.build_nightly == 'true' }}
runs-on: macos-latest
environment: release-build
steps:
- uses: actions/checkout@v4
with:
ref: main # Ensure translations update is included
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.x'
- name: Build
run: |
flutter build ios --release --no-codesign --build-number=$GITHUB_RUN_NUMBER
cd ios
bundle config set deployment 'true'
bundle
bundle exec fastlane beta
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}