This commit is contained in:
@@ -22,26 +22,27 @@ jobs:
|
||||
java-version: 17
|
||||
|
||||
- name: Extract versionName
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(grep -oP 'versionName\s+"[^"]+"' app/build.gradle | cut -d'"' -f2)
|
||||
echo "version=$VERSION" >> $GITEA_OUTPUT
|
||||
echo $VERSION > version.txt
|
||||
echo "Detected version: $VERSION"
|
||||
|
||||
- name: Check if tag exists
|
||||
id: tagcheck
|
||||
run: |
|
||||
if git rev-parse "${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
|
||||
echo "exists=true" >> $GITEA_OUTPUT
|
||||
VERSION=$(cat version.txt)
|
||||
if git rev-parse "$VERSION" >/dev/null 2>&1; then
|
||||
echo "exists=true" > tag_exists.txt
|
||||
else
|
||||
echo "exists=false" >> $GITEA_OUTPUT
|
||||
echo "exists=false" > tag_exists.txt
|
||||
fi
|
||||
|
||||
- name: Stop if version already released
|
||||
if: steps.tagcheck.outputs.exists == 'true'
|
||||
run: |
|
||||
EXISTS=$(cat tag_exists.txt)
|
||||
if [ "$EXISTS" = "true" ]; then
|
||||
echo "Version already released, skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
- name: Decode keystore
|
||||
run: |
|
||||
@@ -50,12 +51,25 @@ jobs:
|
||||
- name: Make Gradlew executable
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: Set up Android SDK
|
||||
run: |
|
||||
mkdir -p $HOME/Android/sdk
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -O cmdline-tools.zip
|
||||
unzip cmdline-tools.zip -d $HOME/Android/cmdline-tools
|
||||
yes | $HOME/Android/cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root=$HOME/Android/sdk "platform-tools" "platforms;android-34" "build-tools;34.0.0"
|
||||
|
||||
- name: Set environment variables
|
||||
run: |
|
||||
echo "ANDROID_HOME=$HOME/Android/sdk" >> $GITHUB_ENV
|
||||
echo "PATH=$HOME/Android/sdk/platform-tools:$PATH" >> $GITHUB_ENV
|
||||
|
||||
- name: Build Release APK
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
run: |
|
||||
VERSION=$(cat version.txt)
|
||||
./gradlew assembleRelease \
|
||||
-Pandroid.injected.signing.store.file=release.keystore \
|
||||
-Pandroid.injected.signing.store.password=$KEYSTORE_PASSWORD \
|
||||
@@ -64,8 +78,9 @@ jobs:
|
||||
|
||||
- name: Create git tag
|
||||
run: |
|
||||
git tag ${{ steps.version.outputs.version }}
|
||||
git push origin ${{ steps.version.outputs.version }}
|
||||
VERSION=$(cat version.txt)
|
||||
git tag $VERSION
|
||||
git push origin $VERSION
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: https://git.daemonlord.ru/actions/gitea-release-action@v1
|
||||
@@ -73,9 +88,9 @@ jobs:
|
||||
server_url: https://git.daemonlord.ru
|
||||
repository: ${{ gitea.repository }}
|
||||
token: ${{ secrets.API_TOKEN }}
|
||||
tag_name: ${{ steps.version.outputs.version }}
|
||||
name: Release ${{ steps.version.outputs.version }}
|
||||
tag_name: $(cat version.txt)
|
||||
name: Release $(cat version.txt)
|
||||
body: |
|
||||
Android release ${{ steps.version.outputs.version }}
|
||||
Android release $(cat version.txt)
|
||||
files: |
|
||||
app/build/outputs/apk/release/*.apk
|
||||
|
||||
Reference in New Issue
Block a user