-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (119 loc) · 3.75 KB
/
assemble-and-stage.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
name: assemble-app
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
jobs:
get-pr-number:
if: github.event_name == 'pull_request'
name: "get-pr-number"
runs-on: ubuntu-latest
steps:
- name: ${{ github.event.pull_request.number }}
run: echo ok
assemble:
if: >
github.event_name == 'push' ||
github.event_name == 'pull_request' &&
!contains(github.event.pull_request.head.ref, 'main')
name: "assemble android application files"
runs-on: ubuntu-latest
steps:
- name: Get HEAD to fetch
id: fetch-head
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "::set-output name=ref::${{ github.ref }}"
else
echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/merge"
fi
- uses: actions/checkout@v2
with:
ref: ${{ steps.fetch-head.outputs.ref }}
- uses: actions/setup-java@v1
with:
java-version: '11'
- uses: eskatos/gradle-command-action@v1
with:
arguments: bundleDebug
dependencies-cache-key: |
**/*.gradle
**/*.gradle.kts
buildSrc/src/**/*.kt
**/gradle.properties
gradle/**
- uses: actions/upload-artifact@v2
with:
name: assemble-output
path: android/build/outputs
retention-days: 14
test:
if: >
github.event_name == 'push' ||
github.event_name == 'pull_request' &&
!contains(github.event.pull_request.head.ref, 'main')
name: "test on feature branches"
runs-on: ubuntu-latest
steps:
- name: Get HEAD to fetch
id: fetch-head
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "::set-output name=ref::${{ github.ref }}"
else
echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/merge"
fi
- uses: actions/checkout@v2
with:
ref: ${{ steps.fetch-head.outputs.ref }}
- uses: actions/setup-java@v1
with:
java-version: '11'
- uses: eskatos/gradle-command-action@v1
with:
arguments: testDebugUnitTest
dependencies-cache-key: |
**/*.gradle
**/*.gradle.kts
buildSrc/src/**/*.kt
**/gradle.properties
gradle/**
- uses: actions/upload-artifact@v2
if: cancelled() != true
with:
name: unit-test-reports
path: |
**/reports
!buildSrc/build/reports
retention-days: 14
stage-default:
if: github.event_name == 'push'
needs: [assemble]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
ref: gh-actions
path: gh-actions
- uses: actions/download-artifact@v2
with:
name: assemble-output
path: ~/assemble-output
- uses: ./gh-actions/actions/find-files
id: find-aab-files
with:
pattern: "~/assemble-output/**/*.aab"
- uses: jmatsu/[email protected]
id: upload
with:
app_owner_name: droidkaigi
api_token: ${{ secrets.DEPLOYGATE_API_TOKEN }}
app_file_path: ${{ fromJSON(steps.find-aab-files.outputs.paths)[0] }}
message: GitHub Actions have staged an artifact of ${{ github.ref }} / ${{ github.sha }}
distribution_find_by: name
distribution_id: ${{ format('staging/{0}', github.ref) }}
release_note: ${{ format('[main] Workflow {0}/{1} based on {2}', github.run_id , github.run_number , github.sha) }}
pin: false