-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (53 loc) · 1.88 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
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
[ -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@v4
with:
commit_message: Bump version to ${{ steps.create.outputs.VERSION }}
- name: Release
id: release
if: ${{ steps.create.outputs.VERSION != '' }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.create.outputs.VERSION }}
body: ${{ steps.create.outputs.CHANGELOG }}
files: build/*
- name: Update update.json
if: ${{ steps.create.outputs.VERSION != '' }}
run: |
jq '.version = "${{ steps.create.outputs.VERSION }}" | .versionCode = ${{ steps.create.outputs.VERSION }} | .zipUrl = "${{ fromJSON(steps.release.outputs.assets)[0].browser_download_url }}"' update.json >update.json.tmp
mv update.json.tmp update.json
- name: Commit update.json
if: ${{ steps.create.outputs.VERSION != '' }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump update.json to ${{ steps.create.outputs.VERSION }}