-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (66 loc) · 2.25 KB
/
Copy pathpublish-automatic.yml
File metadata and controls
76 lines (66 loc) · 2.25 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
name: "Trigger Distribution on PR"
on:
pull_request:
branches: [ main ]
types: [ opened, reopened, synchronize, ready_for_review ]
concurrency:
group: automatic-distribute-${{ github.ref }}
cancel-in-progress: true
jobs:
check-branch:
if: startsWith(github.head_ref, 'release/v') && github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Check if branch matches pattern
id: check_branch
run: |
if [[ ! "${GITHUB_HEAD_REF}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Branch does not match pattern"
exit 1
fi
distribute-android:
needs: get-pr-labels
uses: ./.github/workflows/distribute-flutter-android.yml
if: contains(fromJson(needs.get-pr-labels.outputs.labels), 'google-play-submitted') == false
with:
environment: production
secrets:
AMPLITUDE_KEY: ${{ secrets.AMPLITUDE_KEY }}
ANDROID_BUILD_FILES: ${{ secrets.ANDROID_BUILD_FILES }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
get-pr-labels:
runs-on: ubuntu-latest
needs: check-branch
permissions:
contents: read
outputs:
labels: ${{ steps.get_labels.outputs.labels }}
steps:
- name: Get pull request labels
id: get_labels
uses: actions/github-script@v7
with:
script: |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number
});
const prLabels = labels.map(label => label.name)
core.setOutput('labels', JSON.stringify(prLabels));
add-google-play-submitted-label:
needs: distribute-android
runs-on: ubuntu-latest
steps:
- name: Add Google Play Submitted label
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const label = 'google-play-submitted';
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
labels: [label]
});