-
Notifications
You must be signed in to change notification settings - Fork 48
126 lines (114 loc) · 4.62 KB
/
Copy pathdeploy.yml
File metadata and controls
126 lines (114 loc) · 4.62 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
name: "Deploy"
on:
workflow_call:
inputs:
artifacts-path:
description: "Path to build artifacts"
required: true
type: string
deployment-targets:
description: "JSON array of deployment targets"
required: true
type: string
build-flavor:
description: "Build flavor (dev, staging, internal, beta, prod, fdroid)"
required: true
type: string
build-variant:
description: "Build variant (debug, release, compat, compatrelease)"
required: true
type: string
secrets:
AWS_ACCESS_KEY_ID:
required: false
AWS_SECRET_ACCESS_KEY:
required: false
AWS_S3_BUCKET:
required: false
SERVICE_ACCOUNT_JSON:
required: false
permissions:
contents: write
actions: read
jobs:
deploy:
strategy:
matrix:
target: ${{ fromJson(inputs.deployment-targets) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: ${{ inputs.build-flavor }}-${{ inputs.build-variant }}-artifacts
path: ${{ inputs.artifacts-path }}
- name: Convert to lowercase
id: lowercase
env:
BUILD_FLAVOR_INPUT: ${{ inputs.build-flavor }}
BUILD_VARIANT_INPUT: ${{ inputs.build-variant }}
run: |
echo "build-flavour=$(echo "${BUILD_FLAVOR_INPUT}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
echo "build-variant=$(echo "${BUILD_VARIANT_INPUT}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Prepare release notes
if: matrix.target.type == 'google-play'
run: make release-notes/prepare
- name: Deploy to S3
if: matrix.target.type == 's3'
uses: ./.github/actions/deploy-to-s3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-bucket: ${{ secrets.AWS_S3_BUCKET }}
github-token: ${{ secrets.GITHUB_TOKEN }}
build-flavour: ${{ steps.lowercase.outputs.build-flavour }}
build-variant: ${{ steps.lowercase.outputs.build-variant }}
- name: Create service_account.json
if: matrix.target.type == 'google-play'
env:
SERVICE_ACCOUNT_JSON: ${{ secrets.SERVICE_ACCOUNT_JSON }}
run: |
printf '%s' "${SERVICE_ACCOUNT_JSON}" > service_account.json
- name: Format latest release notes
if: matrix.target.type == 'google-play'
run: make release-notes/format
- name: Deploy to Google Play
if: matrix.target.type == 'google-play'
uses: r0adkll/upload-google-play@e738b9dd8f2476ea806d921b64aacd24f34515a5 # v1
with:
serviceAccountJson: service_account.json
packageName: ${{ matrix.target.package-name }}
releaseFiles: ${{ inputs.artifacts-path }}bundle/${{ steps.lowercase.outputs.build-flavour }}${{ inputs.build-variant }}/*.aab
tracks: ${{ matrix.target.track }}
status: ${{ matrix.target.status || 'completed' }}
whatsNewDirectory: build/whatsnew
userFraction: ${{ matrix.target.user-fraction }}
- name: Deploy to GitHub Release
if: matrix.target.type == 'github-release'
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
with:
files: |
${{ inputs.artifacts-path }}apk/${{ steps.lowercase.outputs.build-flavour }}/${{ steps.lowercase.outputs.build-variant }}/*.apk
${{ matrix.target.additional-files || '' }}
tag_name: ${{ github.event.release.tag_name }}
name: ${{ github.event.release.name }}
body: ${{ github.event.release.body }}
make_latest: false
deployment-summary:
needs: deploy
runs-on: ubuntu-latest
if: always()
steps:
- name: Create deployment summary
env:
BUILD_FLAVOR_INPUT: ${{ inputs.build-flavor }}
BUILD_VARIANT_INPUT: ${{ inputs.build-variant }}
DEPLOYMENT_TARGETS_INPUT: ${{ inputs.deployment-targets }}
DEPLOY_RESULT: ${{ needs.deploy.result }}
run: |
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "**Build**: ${BUILD_FLAVOR_INPUT}${BUILD_VARIANT_INPUT}" >> $GITHUB_STEP_SUMMARY
echo "**Targets**: ${DEPLOYMENT_TARGETS_INPUT}" >> $GITHUB_STEP_SUMMARY
echo "**Status**: ${DEPLOY_RESULT}" >> $GITHUB_STEP_SUMMARY