-
-
Notifications
You must be signed in to change notification settings - Fork 124
117 lines (101 loc) · 3.62 KB
/
release.yml
File metadata and controls
117 lines (101 loc) · 3.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
name: Release
on:
workflow_dispatch:
inputs:
send_fcm:
description: 'Send FCM push notification'
type: boolean
default: true
push:
branches:
- main
jobs:
release:
name: Release
permissions:
contents: write
packages: write
id-token: write
attestations: write
actions: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Cache Gradle
uses: burrunan/gradle-cache-action@v3
- name: Setup keystore
run: |
echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > app/keystore.jks
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "lts/*"
cache: npm
- name: Install dependencies
run: npm ci
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
fingerprint: ${{ vars.GPG_FINGERPRINT }}
- name: Release
uses: cycjimmy/semantic-release-action@v5
id: release
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ENTRY_ALIAS: ${{ secrets.KEYSTORE_ENTRY_ALIAS }}
KEYSTORE_ENTRY_PASSWORD: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }}
- name: Attest
if: steps.release.outputs.new_release_published == 'true'
uses: actions/attest-build-provenance@v2
with:
subject-name: 'Morphe Manager ${{ steps.release.outputs.new_release_git_tag }}'
subject-path: app/build/outputs/apk/release/morphe-manager*.apk
- name: Generate website deploy token
if: steps.release.outputs.new_release_published == 'true'
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.MORPHE_AAMATT_APP_ID }}
private-key: ${{ secrets.WEBSITE_DISPATCH_TOKEN }}
owner: MorpheApp
- name: Trigger website deploy
if: steps.release.outputs.new_release_published == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
await github.rest.repos.createDispatchEvent({
owner: 'MorpheApp',
repo: 'morphe-website',
event_type: 'trigger-deploy'
})
- name: Wait before sending FCM
if: steps.release.outputs.new_release_published == 'true' && (github.event_name == 'push' || inputs.send_fcm == true)
run: sleep 480
- name: Setup Python for FCM
if: steps.release.outputs.new_release_published == 'true' && (github.event_name == 'push' || inputs.send_fcm == true)
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Send FCM push notification
if: steps.release.outputs.new_release_published == 'true' && (github.event_name == 'push' || inputs.send_fcm == true)
env:
FCM_PROJECT_ID: ${{ secrets.FCM_PROJECT_ID }}
FCM_SERVICE_ACCOUNT_JSON: ${{ secrets.FCM_SERVICE_ACCOUNT_JSON }}
NEW_TAG: ${{ steps.release.outputs.new_release_git_tag }}
BRANCH: ${{ github.ref_name }}
run: |
pip install cryptography
python3 .github/scripts/send_fcm.py