forked from openhab/openhab-android
-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (69 loc) · 2.67 KB
/
commit-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
name: Bump version and update changelog
on:
release:
types:
- created
env:
GRADLE_FILE: "mobile/build.gradle"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump version
run: |
# Get and bump version code
VERSION_CODE=$(grep 'versionCode' $GRADLE_FILE | sed -r 's/(.*) (.*)$/\2/')
let VERSION_CODE++
# Remove "-release$" and and "^refs/tags/" from version name
TAG_NAME="${GITHUB_REF##*/}"
VERSION_NAME="${TAG_NAME%-release}"
echo "Replace versionCode with $VERSION_CODE"
sed --in-place -r "s/versionCode (.*)/versionCode ${VERSION_CODE}/" $GRADLE_FILE
echo "Replace versionName with $VERSION_NAME"
sed --in-place -r "s/versionName \"(.*)\"/versionName \"${VERSION_NAME}\"/" $GRADLE_FILE
# Save variables for next steps
echo "VERSION_CODE=$VERSION_CODE" >> $GITHUB_ENV
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Build store description
run: |
if $(echo "$GITHUB_REF" | grep -q "beta")
then
echo "Build store description for beta version on F-Droid"
python3 assets/store_descriptions/generate_and_validate.py fdroidBeta
else
echo "Build store description for stable version on F-Droid"
python3 assets/store_descriptions/generate_and_validate.py fdroid
fi
- name: Download release notes
run: |
echo "Get release notes for version code ${{ env.VERSION_CODE }}"
retryCount=0
until curl https://api.github.com/repos/openhab/openhab-android/releases | jq -r '.[0].body' > fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt
do
let retryCount++
if [ "$retryCount" -gt 20 ]
then
exit 1
fi
echo "Download failed. Retry"
sleep 5
done
echo ""
echo "Got release notes:"
echo "========================"
cat fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt
echo "========================"
- name: Commit changes
uses: EndBug/[email protected]
with:
add: '.'
author_name: openhab-bot
author_email: [email protected]
message: "Bump version to ${{ env.VERSION_NAME }} and update fastlane metadata"
commit: --signoff
new_branch: main
tag: "${{ env.TAG_NAME }}-fdroid"