Moze wersja 1.0.0?
This commit is contained in:
@@ -27,6 +27,22 @@ jobs:
|
||||
- name: Grant execute permission
|
||||
run: chmod +x ./gradlew
|
||||
|
||||
- name: Update version in assets
|
||||
run: |
|
||||
set -e
|
||||
TAG="${{ github.ref_name }}"
|
||||
# Jeśli tag jest pusty (np. push nie na tag), użyjemy skróconego SHA
|
||||
if [ -z "$TAG" ] || [ "$TAG" = "main" ]; then
|
||||
TAG=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
echo "Setting version to: $TAG"
|
||||
# Aktualizacja pliku js/version.js
|
||||
echo "const APP_VERSION = '$TAG';" > app/src/main/assets/js/version.js
|
||||
echo "document.addEventListener('DOMContentLoaded', () => {
|
||||
const el = document.getElementById('app-version') || document.getElementById('commit-sha');
|
||||
if (el) el.textContent = '$TAG';
|
||||
});" >> app/src/main/assets/js/version.js
|
||||
|
||||
- name: Build APK
|
||||
run: ./gradlew assembleRelease
|
||||
|
||||
@@ -116,6 +132,7 @@ jobs:
|
||||
|
||||
OWNER="${{ github.repository_owner }}"
|
||||
REPO_NAME=$(echo "${{ github.repository }}" | cut -d/ -f2)
|
||||
TAG="${{ github.ref_name }}"
|
||||
|
||||
if [ -z "$APK_PATH" ]; then
|
||||
echo "APK_PATH not set" >&2
|
||||
@@ -126,8 +143,20 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPLOAD_URL="$API_BASE/repos/$OWNER/$REPO_NAME/releases/$RELEASE_ID/assets?name=$(basename $APK_PATH)"
|
||||
echo "Uploading $APK_PATH to $UPLOAD_URL"
|
||||
# Tworzymy ładną nazwę dla pliku
|
||||
FRIENDLY_NAME="Matma-${TAG}.apk"
|
||||
cp "$APK_PATH" "./$FRIENDLY_NAME"
|
||||
|
||||
curl --fail -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$APK_PATH" "$UPLOAD_URL"
|
||||
UPLOAD_URL="$API_BASE/repos/$OWNER/$REPO_NAME/releases/$RELEASE_ID/assets?name=$FRIENDLY_NAME"
|
||||
echo "Uploading $FRIENDLY_NAME to $UPLOAD_URL"
|
||||
|
||||
curl --fail -s -H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"./$FRIENDLY_NAME" \
|
||||
"$UPLOAD_URL"
|
||||
|
||||
# Dodanie bezpośredniego linku do podsumowania buildu w Gitea
|
||||
DOWNLOAD_URL="${SERVER_CLEAN}/${OWNER}/${REPO_NAME}/releases/download/${TAG}/${FRIENDLY_NAME}"
|
||||
echo "### ✅ APK gotowy do pobrania!" >> $GITHUB_STEP_SUMMARY
|
||||
echo "[Pobierz plik $FRIENDLY_NAME]($DOWNLOAD_URL)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Adres: $DOWNLOAD_URL" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
Reference in New Issue
Block a user