-
Notifications
You must be signed in to change notification settings - Fork 221
91 lines (75 loc) · 3.31 KB
/
release.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
name: Release
on:
release:
types: [ published ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
name: Release
if: ${{ github.repository == 'fossasia/badgemagic-app' }}
runs-on: ubuntu-latest
steps:
- name: Download repository
uses: actions/checkout@v4
- name: Prepare Secrets (Android)
env:
ENCRYPTED_F10B5E0E5262_IV: ${{ secrets.ENCRYPTED_F10B5E0E5262_IV }}
ENCRYPTED_F10B5E0E5262_KEY: ${{ secrets.ENCRYPTED_F10B5E0E5262_KEY }}
run: |
bash scripts/prep-android-key.sh
- name: Prepare Secrets (iOS)
if: ${{ github.repository == 'fossasia/badgemagic-app' }}
env:
ENCRYPTED_IOS_IV: ${{ secrets.ENCRYPTED_IOS_IV }}
ENCRYPTED_IOS_KEY: ${{ secrets.ENCRYPTED_IOS_KEY }}
run: |
bash scripts/prep-ios-key.sh
- name: Download Assets
id: download-assets
run: |
gh release download ${{ github.event.release.tag_name }} --pattern '*.txt'
read -r version_code < versionCode.txt
echo "VERSION_CODE=$version_code" >> $GITHUB_OUTPUT
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Update Fastlane Metadata (Android)
run: |
cd ./android
git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
cd fastlane
echo "${{ github.event.release.body }}" > metadata/android/en-US/changelogs/${{ steps.download-assets.outputs.VERSION_CODE }}.txt
# Force push to fastlane branch
git checkout --orphan temporary
git add --all .
git commit -am "[Auto] Update changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))"
git branch -D fastlane-android
git branch -m fastlane-android
git push --force origin fastlane-android
- name: Push version to production (Android)
run: |
cd ./android
fastlane promoteToProduction version_code:${{ steps.download-assets.outputs.VERSION_CODE }}
if [[ $? -ne 0 ]]; then
exit 1
fi
- name: Update Fastlane Metadata (iOS)
run: |
cd ./iOS
git clone --branch=fastlane-ios --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
cd fastlane
echo "${{ github.event.release.body }}" > metadata/en-US/release_notes.txt
# Force push to fastlane branch
git checkout --orphan temporary
git add --all .
git commit -am "[Auto] Update changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))"
git branch -D fastlane-ios
git branch -m fastlane-ios
git push --force origin fastlane-ios
- name: Push version to production (iOS)
run: |
cd ./iOS
fastlane promoteToProduction build_number:${{ steps.download-assets.outputs.VERSION_CODE }}
if [[ $? -ne 0 ]]; then
exit 1
fi