-
Notifications
You must be signed in to change notification settings - Fork 922
155 lines (132 loc) · 6.34 KB
/
release_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
name: Release - Nightly Release to Internal and Firebase
on:
schedule:
- cron: '0 2 * * *' # run at 3 AM UTC
workflow_dispatch:
env:
ASANA_PAT: ${{ secrets.GH_ASANA_SECRET }}
GOOGLE_APPLICATION_CREDENTIALS: '#{ENV["HOME"]}/jenkins_static/com.duckduckgo.mobile.android/ddg-upload-firebase.json'
GH_TOKEN: ${{ secrets.GT_DAXMOBILE }}
jobs:
create-tag:
name: Generate and upload nightly bundle to Play Store Internal track
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GT_DAXMOBILE }}
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
bundler-cache: true
- name: Set up git config
run: |
git remote set-url origin https://${{ secrets.GT_DAXMOBILE }}@github.com/duckduckgo/Android.git/
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Get latest tag
id: get_latest_tag
run: |
output=$(git for-each-ref --sort=taggerdate --format='%(refname:short)' refs/tags | tail -n 1)
echo "Latest tag: $output"
echo "latest_tag=$output" >> $GITHUB_OUTPUT
- name: Check for changes
id: check_for_changes
uses: ./.github/actions/check-for-changes-since-tag
with:
github_token: ${{ secrets.GT_DAXMOBILE }}
tag: ${{ steps.get_latest_tag.outputs.latest_tag }}
- name: Notify if no changes
if: steps.check_for_changes.outputs.has_changes == 'false'
run: |
echo "No new commits since the last tag. Skipping nightly release."
echo "No new commits since the last tag. Skipping nightly release." >> $GITHUB_STEP_SUMMARY
exit 0
- name: Decode upload keys
if: steps.check_for_changes.outputs.has_changes == 'true'
uses: davidSchuppa/base64Secret-toFile-action@199e78f212c854d2284fada7f3cd3aba3e37d208
with:
secret: ${{ secrets.UPLOAD_RELEASE_PROPERTIES }}
fileName: ddg_android_build_upload.properties
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/
- name: Decode key file
if: steps.check_for_changes.outputs.has_changes == 'true'
uses: davidSchuppa/base64Secret-toFile-action@199e78f212c854d2284fada7f3cd3aba3e37d208
with:
secret: ${{ secrets.UPLOAD_RELEASE_KEY }}
fileName: ddg-upload-keystore.jks
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/
- name: Decode Play Store credentials file
if: steps.check_for_changes.outputs.has_changes == 'true'
uses: davidSchuppa/base64Secret-toFile-action@199e78f212c854d2284fada7f3cd3aba3e37d208
with:
secret: ${{ secrets.UPLOAD_PLAY_CREDENTIALS }}
fileName: api.json
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/
- name: Decode Firebase credentials file
if: steps.check_for_changes.outputs.has_changes == 'true'
uses: davidSchuppa/base64Secret-toFile-action@199e78f212c854d2284fada7f3cd3aba3e37d208
with:
secret: ${{ secrets.UPLOAD_FIREBASE_CREDENTIALS }}
fileName: ddg-upload-firebase.json
destination-path: $HOME/jenkins_static/com.duckduckgo.mobile.android/
- name: Clean project
if: steps.check_for_changes.outputs.has_changes == 'true'
run: |
gradle clean
- name: Assemble the bundle
if: steps.check_for_changes.outputs.has_changes == 'true'
run: gradle bundleInternalRelease -PversionNameSuffix=-nightly -PuseUploadSigning -PlatestTag=${{ steps.get_latest_tag.outputs.latest_tag }} -Pbuild-date-time
- name: Generate nightly version name
if: steps.check_for_changes.outputs.has_changes == 'true'
id: generate_version_name
run: |
output=$(gradle getBuildVersionName -PversionNameSuffix=-nightly -PlatestTag=${{ steps.get_latest_tag.outputs.latest_tag }} --quiet | tail -n 1)
echo "version=$output" >> $GITHUB_OUTPUT
- name: Capture App Bundle Path
if: steps.check_for_changes.outputs.has_changes == 'true'
id: capture_output
run: |
output=$(find app/build/outputs/bundle/internalRelease -name "*.aab")
echo "bundle_path=$output" >> $GITHUB_OUTPUT
- name: Upload bundle to Play Store Internal track
if: steps.check_for_changes.outputs.has_changes == 'true'
id: create_app_bundle
run: |
bundle exec fastlane deploy_dogfood aab_path:${{ steps.capture_output.outputs.bundle_path }}
- name: Tag Nightly release
if: steps.check_for_changes.outputs.has_changes == 'true'
id: tag_nightly_release
run: |
git checkout develop
git tag -a ${{ steps.generate_version_name.outputs.version }} -m "Create tag ${{ steps.generate_version_name.outputs.version }} for nightly release."
git push origin ${{ steps.generate_version_name.outputs.version }}
- name: Upload APK as artifact
if: steps.check_for_changes.outputs.has_changes == 'true'
uses: actions/upload-artifact@v4
with:
name: duckduckgo-${{ steps.generate_version_name.outputs.version }}.apk
path: duckduckgo.apk
- name: Set successful summary
if: steps.check_for_changes.outputs.has_changes == 'true'
run: |
echo "### Nightly release completed! :rocket:" >> $GITHUB_STEP_SUMMARY
- name: Create Asana task when workflow failed
if: ${{ failure() }}
uses: duckduckgo/[email protected]
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: GH Workflow Failure - Nightly Release
asana-task-description: The Nightly Release Task workflow has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }}
action: 'create-asana-task'