Skip to content

Build

Build #307

Workflow file for this run

name: Build
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- 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 }}