-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (67 loc) · 2.41 KB
/
build.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
name: Build
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create
id: create
run: |
./create_mod.sh -e -n
[ -z "$(git status -s)" ] && exit
VERSION=$(sed -n 's/^versionCode=//p' module.prop)
echo "VERSION=$VERSION" >>"$GITHUB_OUTPUT"
{
echo "CHANGELOG<<EOF"
FLAG=false
while IFS= read -r line; do
if echo "$line" | grep -qs "^###"; then
[ "$FLAG" = true ] && break
FLAG=true
fi
echo "$line"
done <CHANGELOG.md
echo "EOF"
} >>"$GITHUB_OUTPUT"
- name: Update the module
if: ${{ steps.create.outputs.VERSION != '' }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Bump version to ${{ steps.create.outputs.VERSION }}
- name: Release
id: release
if: ${{ steps.create.outputs.VERSION != '' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.create.outputs.VERSION }}
body: ${{ steps.create.outputs.CHANGELOG }}
files: build/*
- name: Update update.json
if: ${{ steps.create.outputs.VERSION != '' }}
env:
VERSION: ${{ steps.create.outputs.VERSION }}
ASSETS: ${{ steps.release.outputs.assets }}
run: |
echo "$ASSETS" | jq -c .[] | while IFS= read -r asset; do
name=$(echo "$asset" | jq -r '.name')
dl_url=$(echo "$asset" | jq -r '.browser_download_url')
case $name in
org.fdroid.fdroid.privileged.mod_*.zip)
jq ".version = \"$VERSION\" | .versionCode = $VERSION | .zipUrl = \"$dl_url\"" update.json >update.json.tmp
mv update.json.tmp update.json
;;
org.fdroid.fdroid.privileged.mod.netinst_*.zip)
jq ".version = \"$VERSION\" | .versionCode = $VERSION | .zipUrl = \"$dl_url\"" update.json >update-netinst.json
;;
esac
done
- name: Commit update.json
if: ${{ steps.create.outputs.VERSION != '' }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Bump update.json to ${{ steps.create.outputs.VERSION }}