7 Commits

Author SHA1 Message Date
ksan dcf65840c0 fixing wrong directory in ci
CI/CD / Backend Unit Tests (push) Successful in 2m30s
CI/CD / Deploy (push) Successful in 2m7s
CI/CD / Mobile Release (push) Successful in 21m43s
2026-06-11 17:54:12 +02:00
ksan 194d598d6d fixing spelling mistake
CI/CD / Backend Unit Tests (push) Successful in 2m13s
CI/CD / Deploy (push) Successful in 2m16s
CI/CD / Mobile Release (push) Failing after 21m26s
2026-06-11 17:23:21 +02:00
ksan d76434014f aaa
CI/CD / Backend Unit Tests (push) Successful in 2m8s
CI/CD / Deploy (push) Successful in 2m7s
CI/CD / Mobile Release (push) Failing after 21m35s
2026-06-11 16:51:29 +02:00
ksan 266802088a fixing
CI/CD / Backend Unit Tests (push) Successful in 2m8s
CI/CD / Deploy (push) Successful in 2m9s
CI/CD / Mobile Release (push) Has been cancelled
2026-06-11 16:43:38 +02:00
ksan 6c98e4a469 updated ci file
CI/CD / Backend Unit Tests (push) Successful in 2m12s
CI/CD / Deploy (push) Successful in 2m6s
CI/CD / Mobile Release (push) Failing after 1m12s
2026-06-11 16:33:16 +02:00
ksan 5d2898dd13 fixing error
CI/CD / Backend Unit Tests (push) Successful in 2m20s
CI/CD / Deploy (push) Successful in 2m8s
CI/CD / Mobile Release (push) Failing after 25m30s
2026-06-11 15:47:48 +02:00
ksan 694b68cbc5 updated ci/cd to add releases and testing claude code on my project
CI/CD / Backend Unit Tests (push) Successful in 2m11s
CI/CD / Deploy (push) Successful in 2m0s
CI/CD / Mobile Release (push) Failing after 21m39s
2026-06-11 15:11:09 +02:00
2 changed files with 142 additions and 0 deletions
+114
View File
@@ -82,3 +82,117 @@ jobs:
ssh -i ~/.ssh/key \
"${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" \
"cd ~/programs/etf-oglasi-server && docker compose pull && docker compose up -d"
mobile-release:
name: Mobile Release
needs: backend-unit-tests
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Accept Android SDK licenses
run: yes | sdkmanager --licenses > /dev/null || true
- name: Determine next mobile version
id: version
run: |
git fetch --tags
LAST=$(git tag -l 'mobile-v*' | sed 's/mobile-v//' | sort -n | tail -1)
NEXT=$(( ${LAST:-0} + 1 ))
echo "next=$NEXT" >> "$GITHUB_OUTPUT"
echo "tag=mobile-v$NEXT" >> "$GITHUB_OUTPUT"
- name: Stamp app version
run: node scripts/set-mobile-version.js ${{ steps.version.outputs.next }}
- name: Restore Firebase config
run: echo "${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}" | base64 -d > google-services.json
- name: Restore env
run: echo "EXPO_PUBLIC_API_URL=${{ secrets.EXPO_PUBLIC_API_URL }}" > .env
- name: Restore signing keystore
run: echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > ksan.dev.keystore
- name: Install dependencies
run: npm ci
- name: Prebuild Android project
run: npx expo prebuild -p android --no-install
- name: Increase Gradle memory
run: |
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g" >> android/gradle.properties
- name: Build signed release APK
working-directory: frontend/android
run: |
./gradlew assembleRelease --no-daemon \
-Pandroid.injected.signing.store.file="$PWD/../ksan.dev.keystore" \
-Pandroid.injected.signing.store.password="${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" \
-Pandroid.injected.signing.key.alias="${{ secrets.ANDROID_KEY_ALIAS }}" \
-Pandroid.injected.signing.key.password="${{ secrets.ANDROID_KEY_PASSWORD }}"
- name: Locate APK
id: apk
run: |
APK=$(find android/app/build/outputs/apk/release -name "*.apk" | head -n1)
OUT="etfoglasi-${{ steps.version.outputs.tag }}.apk"
cp "$APK" "$OUT"
echo "path=$OUT" >> "$GITHUB_OUTPUT"
echo "name=$OUT" >> "$GITHUB_OUTPUT"
- name: Create Gitea release
run: |
API="https://git.${{ secrets.DOMAIN }}/api/v1/repos/${{ secrets.REGISTRY_USER }}/etf-oglasi"
AUTH="Authorization: token ${{ secrets.GITEARELEASES_TOKEN }}"
HTTP_CODE=$(curl -s -o release.json -w "%{http_code}" -X POST \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${{ steps.version.outputs.tag }}\",\"target_commitish\":\"${{ github.sha }}\",\"name\":\"${{ steps.version.outputs.tag }}\",\"draft\":false,\"prerelease\":false}" \
"$API/releases")
echo "HTTP $HTTP_CODE"
cat release.json
if [ "$HTTP_CODE" != "201" ]; then
echo "Failed to create release"
exit 1
fi
RELEASE_ID=$(node -pe "JSON.parse(require('fs').readFileSync('release.json','utf8')).id")
HTTP_CODE=$(curl -s -o asset.json -w "%{http_code}" -X POST \
-H "$AUTH" \
-F "attachment=@${{ steps.apk.outputs.path }}" \
"$API/releases/$RELEASE_ID/assets?name=${{ steps.apk.outputs.name }}")
echo "HTTP $HTTP_CODE"
cat asset.json
if [ "$HTTP_CODE" != "201" ]; then
echo "Failed to upload asset"
exit 1
fi
+28
View File
@@ -0,0 +1,28 @@
// Used by CI to stamp a mobile release build with its version number.
// Updates version.json (read by hooks/useUpdatecheck.tsx) and app.json's
// android.versionCode/versionName so the build, the in-app update check,
// and the Gitea release tag (mobile-vN) all agree on the same number.
const fs = require('fs');
const path = require('path');
const version = parseInt(process.argv[2], 10);
if (!Number.isInteger(version) || version <= 0) {
console.error('Usage: node set-mobile-version.js <positive integer>');
process.exit(1);
}
const root = path.join(__dirname, '..');
fs.writeFileSync(
path.join(root, 'version.json'),
JSON.stringify({ version }, null, 2) + '\n',
);
const appJsonPath = path.join(root, 'app.json');
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'));
appJson.expo.version = `1.0.${version}`;
appJson.expo.android = appJson.expo.android ?? {};
appJson.expo.android.versionCode = version;
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2) + '\n');
console.log(`Stamped mobile version ${version}`);