forked from LeadRDRK/UmaPatcher
-
Notifications
You must be signed in to change notification settings - Fork 5
98 lines (79 loc) · 2.9 KB
/
Copy pathcreate_release.yml
File metadata and controls
98 lines (79 loc) · 2.9 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Create Android Release
permissions:
contents: write
id-token: write
attestations: write
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Decode release signing key
run: |
echo "${{ secrets.ANDROID_SIGNING_KEY }}" | base64 -d > release.keystore
echo "RELEASE_KEYSTORE_PATH=$(realpath release.keystore)" >> $GITHUB_ENV
- name: Build with Gradle
run: ./gradlew build
env:
SIGNING_KEY_FILE: ${{ env.RELEASE_KEYSTORE_PATH }}
SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
- name: Attest App
uses: actions/attest@v4
with:
subject-path: app/build/outputs/apk/release/*.apk
- name: Set app version env var
run: |
VERSION_NAME=$(grep -oP 'versionName\s*"\K[^"]+' app/build.gradle)
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
- name: Create release notes
run: |
if ! git rev-parse "$LATEST_TAG" >/dev/null 2>&1; then
git tag $LATEST_TAG
fi
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${LATEST_TAG}^")
if [ -z "$PREVIOUS_TAG" ]; then
PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD)
fi
echo "## What's Changed" > CHANGELOG.md
COMMIT_HASHES=$(git rev-list --no-merges ${PREVIOUS_TAG}..${LATEST_TAG})
IFS=$'\n'
for hash in $COMMIT_HASHES; do
subject=$(git show -s --format=%s $hash)
body=$(git show -s --format=%b $hash)
author=$(git show -s --format=%an $hash)
short_hash=$(git show -s --format=%h $hash)
echo "* **$subject**" >> CHANGELOG.md
if [ -n "$body" ]; then
echo "$body" | while read -r line; do
if [ -z "$line" ]; then continue; fi
clean_line=$(echo "$line" | sed -E 's/^[ \t]*[-*+][ \t]*//')
echo " * $clean_line" >> CHANGELOG.md
done
fi
echo " (by @$author in $short_hash)" >> CHANGELOG.md
echo "" >> CHANGELOG.md
done
unset IFS
env:
LATEST_TAG: "v${{ env.VERSION_NAME }}"
- name: Upload binaries to a release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
files: app/build/outputs/apk/release/*.apk
tag_name: "v${{ env.VERSION_NAME }}"