forked from AnySoftKeyboard/AnySoftKeyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (176 loc) · 7.32 KB
/
deploy.yml
File metadata and controls
178 lines (176 loc) · 7.32 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
---
name: deployment
on: deployment
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.deployment.task }}-${{ github.event.deployment.environment }}-${{ github.event.deployment.payload.previous_environment }}
cancel-in-progress: true
env:
TERM: dumb
jobs:
deploy:
runs-on: ubuntu-24.04
timeout-minutes: 40
outputs:
deployment_environment: ${{ github.event.deployment.environment }}
steps:
- uses: actions/checkout@v5.0.0
with:
token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
- uses: actions/checkout@v5.0.0
with:
repository: ${{ secrets.SECRETS_REPOSITORY }}
token: ${{ secrets.BOT_SECRETS_R_GITHUB_TOKEN }}
path: ${{ secrets.SECRETS_REPOSITORY_FOLDER }}
ref: main
- uses: bazel-contrib/setup-bazel@0.15.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: status-in-progress
run: |
bazel run //js/github_deployments -- status \
--api-username="${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}" \
--token="${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}" \
--owner=${{ github.repository_owner }} \
--repo="AnySoftKeyboard" \
--environment="${{ github.event.deployment.environment }}" \
--deployment-id="${{ github.event.deployment.id }}" \
--state=in_progress
- uses: ./.github/actions/deploy
with:
deployment_environment: ${{ github.event.deployment.environment }}
previous_deployment_environment: ${{ github.event.deployment.payload.previous_environment }}
deployment_task: ${{ github.event.deployment.task }}
crash_report_email: ${{ secrets.ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL }}
secrets_repo_folder: ${{ secrets.SECRETS_REPOSITORY_FOLDER }}
keystore_password: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_PASSWORD }}
keystore_key_password: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_KEY_PASSWORD }}
- name: status-success
if: success()
run: |
bazel run //js/github_deployments -- success \
--api-username="${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}" \
--token="${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}" \
--owner=${{ github.repository_owner }} \
--repo="AnySoftKeyboard" \
--environment="${{ github.event.deployment.environment }}" \
--sha="${{ github.event.deployment.sha }}"
- name: status-failure
if: failure()
run: |
bazel run //js/github_deployments -- status \
--api-username="${{ secrets.BOT_MASTER_RW_GITHUB_USERNAME }}" \
--token="${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}" \
--owner=${{ github.repository_owner }} \
--repo="AnySoftKeyboard" \
--environment="${{ github.event.deployment.environment }}" \
--deployment-id="${{ github.event.deployment.id }}" \
--state=failure
- uses: actions/upload-artifact@v4.6.2
if: always()
continue-on-error: true
with:
name: deploy-logging
path: build/build-logging
- uses: actions/upload-artifact@v4.6.2
if: always()
continue-on-error: true
with:
name: bundles
path: outputs/bundle
- uses: actions/upload-artifact@v4.6.2
if: always()
continue-on-error: true
with:
name: apks
path: outputs/apk
- uses: actions/upload-artifact@v4.6.2
if: always()
continue-on-error: true
with:
name: proguard-mapping
path: ime/app/build/outputs/mapping
- uses: actions/upload-artifact@v4.6.2
continue-on-error: true
if: always()
with:
name: fdroid-metadata
path: outputs/fdroid
post_deployment:
name: Post-Deployment Actions
needs: deploy
runs-on: ubuntu-24.04
if: success() && startsWith(needs.deploy.outputs.deployment_environment, 'imeProduction_production_')
env:
GH_TOKEN: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v5.0.0
with:
token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
- name: "Derive tag and version from branch"
run: |
VERSION_WITH_V=$(echo "${{ github.event.deployment.ref }}" | sed 's/release-branch-ime-//')
echo "VERSION_WITH_V=${VERSION_WITH_V}" >> $GITHUB_ENV
TAG_NAME=$(echo "${VERSION_WITH_V}" | sed 's/^v//')
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
- uses: actions/download-artifact@v5.0.0
if: endsWith(needs.deploy.outputs.deployment_environment, '_010')
with:
name: apks
path: apks
- uses: actions/download-artifact@v5.0.0
if: endsWith(needs.deploy.outputs.deployment_environment, '_010')
with:
name: bundles
path: bundles
- uses: actions/download-artifact@v5.0.0
if: endsWith(needs.deploy.outputs.deployment_environment, '_010')
with:
name: proguard-mapping
path: proguard-mapping
- name: "Delete prior release and tag"
if: endsWith(needs.deploy.outputs.deployment_environment, '_010')
run: gh release delete "${{ env.TAG_NAME }}" --cleanup-tag --yes || true
- name: Create GitHub Pre-Release
if: endsWith(needs.deploy.outputs.deployment_environment, '_010')
uses: softprops/action-gh-release@v2.3.2
with:
token: ${{ secrets.BOT_MASTER_RW_GITHUB_TOKEN }}
tag_name: ${{ env.TAG_NAME }}
name: ${{ env.VERSION_WITH_V }}
body_path: ime/app/src/main/play/release-notes/en-US/alpha.txt
prerelease: true
files: |
apks/*.apk
bundles/*.aab
proguard-mapping/**/*.txt
- name: Update GitHub Release to Stable
if: endsWith(needs.deploy.outputs.deployment_environment, '_100')
run: gh release edit "${{ env.TAG_NAME }}" --prerelease=false
- name: Create halt marker file
if: endsWith(needs.deploy.outputs.deployment_environment, '_100')
run: |-
MARKER_FILE="deployment/halt_deployment_marker"
git config --global --add safe.directory "${PWD}"
BRANCH_NAME="${{ github.event.deployment.ref }}"
echo "Will create ${MARKER_FILE} to halt future releases in the branch '${BRANCH_NAME}'."
# Check if marker file already exists
if [[ -f "${MARKER_FILE}" ]]; then
echo "Halt marker file already exists. Skipping creation."
exit 0
fi
mkdir -p "$(dirname "${MARKER_FILE}")"
echo "Full deployment to '${{ needs.deploy.outputs.deployment_environment }}' in branch '${BRANCH_NAME}' was successful." > "${MARKER_FILE}"
git config --global user.email "ask@evendanan.net"
git config --global user.name "Polyglot"
git add "${MARKER_FILE}"
git commit -m "Halting deploy for ${{ needs.deploy.outputs.deployment_environment }}" || {
echo "Failed to commit halt marker file"
exit 1
}
git push origin "HEAD:${BRANCH_NAME}" || {
echo "Failed to push to origin HEAD:${BRANCH_NAME}"
git remote -v
exit 1
}