-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (73 loc) · 2.97 KB
/
Copy pathpublish.yml
File metadata and controls
86 lines (73 loc) · 2.97 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
name: eas update
on:
# schedule:
# - cron: '0 0 * * 1-5'
workflow_dispatch:
inputs:
profile:
description: 'Deployment profile'
required: true
default: 'development'
type: choice
options:
- development
- preview
- production
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- name: 🏗 Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: 🏗 Checkout the repository
uses: actions/checkout@v4
- name: 🏗 Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 📦 Install dependencies
run: yarn install
- name: 🔍 Determine profile
id: determine-profile
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Profile selected from input: ${{ github.event.inputs.profile }}"
echo "EAS_PROFILE=${{ github.event.inputs.profile }}" >> $GITHUB_ENV
else
echo "Scheduled run, using default profile: development"
echo "EAS_PROFILE=development" >> $GITHUB_ENV
fi
- name: 🚀 Build app
id: build-app
run: |
eas build --profile ${{ env.EAS_PROFILE }} --platform android --non-interactive --json > eas-build.json
APPLICATION_ARCHIVE_URL=$(jq -r '.[0].artifacts.applicationArchiveUrl' eas-build.json)
echo "Application Archive URL: $APPLICATION_ARCHIVE_URL"
echo "APPLICATION_ARCHIVE_URL=$APPLICATION_ARCHIVE_URL" >> "$GITHUB_OUTPUT"
- name: 🎆 Generate QR Code
id: generate-qrcode
run: |
sudo apt-get install -y qrencode
qrencode -o qrcode.png "${{steps.build-app.outputs.APPLICATION_ARCHIVE_URL}}"
BASE64_QR=$(base64 -w 0 qrcode.png)
MD5_QR=$(md5sum qrcode.png | awk '{ print $1 }')
echo "BASE64_QR=$BASE64_QR" >> "$GITHUB_OUTPUT"
echo "MD5_QR=$MD5_QR" >> "$GITHUB_OUTPUT"
- name: 🤖 IM Notification
run: |
curl -n "${{secrets.WECOM_WEBHOOK}}" \
--header 'Content-Type: application/json' \
--data '{"msgtype":"text","text": {"content":"Visit Link App Build Success : ${{steps.build-app.outputs.APPLICATION_ARCHIVE_URL}}"}}'
curl -n "${{secrets.WECOM_WEBHOOK}}" \
--header 'Content-Type: application/json' \
--data '{"msgtype":"image","image":{"base64":"${{steps.generate-qrcode.outputs.BASE64_QR}}","md5":"${{steps.generate-qrcode.outputs.MD5_QR}}"}}'