72 lines
2.0 KiB
YAML
72 lines
2.0 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
needs: build-apk
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Download APK artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: carry-your-live-release
|
|
path: .
|
|
|
|
- name: Compute next version
|
|
id: version
|
|
run: |
|
|
latest=$(git tag --list 'v[0-9]*' --sort=-v:refname | head -n 1)
|
|
if [ -z "$latest" ]; then
|
|
next="v1.0.0"
|
|
else
|
|
latest=${latest#v}
|
|
IFS='.' read -r major minor patch <<< "$latest"
|
|
next="v${major}.${minor}.$((patch + 1))"
|
|
fi
|
|
echo "next=${next}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build changelog
|
|
id: changelog
|
|
run: |
|
|
prev_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
|
if [ -z "$prev_tag" ]; then
|
|
log=$(git log --oneline --no-merges main | head -n 40)
|
|
else
|
|
log=$(git log --oneline --no-merges "$prev_tag"..main | head -n 40)
|
|
fi
|
|
{
|
|
echo "body<<EOF"
|
|
echo "## What's new in this release"
|
|
echo ""
|
|
echo "$log" | sed 's/^/- /'
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.version.outputs.next }}
|
|
name: ${{ steps.version.outputs.next }}
|
|
body: ${{ steps.changelog.outputs.body }}
|
|
generate_release_notes: false
|
|
|
|
- name: Upload APK to release
|
|
uses: actions/upload-release-asset@v1
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
file: ./carry-your-live/android/app/build/outputs/release/app-release.apk
|
|
asset_name: carry-your-live-release.apk
|
|
asset_type: application/vnd.android.package-archive
|
|
asset_title: Carry Your Live Release |