Skip to content

chore: bump version to 1.0.34 #97

chore: bump version to 1.0.34

chore: bump version to 1.0.34 #97

Workflow file for this run

name: Build Android APK
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
version:
description: 'Optional version to use (e.g. 1.2.3). If provided, this overrides tag-based version.'
required: false
default: ''
release_notes:
description: 'Release notes to include in the GitHub Release'
required: false
default: ''
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Release Notes from Commit History
id: release_notes
run: |
echo "Recent tags:"
git tag --sort=-v:refname | head -n 5
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
CURRENT_REF="${{ github.ref_name }}"
# Find the previous tag relative to the current tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${CURRENT_REF}^" 2>/dev/null || echo "")
else
CURRENT_REF="HEAD"
# Find the latest tag reachable from HEAD
PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
fi
echo "Generating notes from '$PREVIOUS_TAG' to '$CURRENT_REF'"
if [[ -z "$PREVIOUS_TAG" ]]; then
echo "No previous tag found. Getting last 20 commits."
COMMITS=$(git log -n 20 --pretty=format:"- %s (%h)" "$CURRENT_REF")
else
COMMITS=$(git log "$PREVIOUS_TAG..$CURRENT_REF" --pretty=format:"- %s (%h)")
fi
# Filter out merge commits if desired, or keep them.
# Here we keep them but maybe format them nicely?
# Let's just use the raw log for now as requested.
# Multiline output to GITHUB_OUTPUT
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "LOG<<$EOF" >> $GITHUB_OUTPUT
echo "$COMMITS" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Determine version
id: version
run: |
# Prefer manual input when provided
if [[ -n "${{ github.event.inputs.version || '' }}" ]]; then
VERSION="${{ github.event.inputs.version }}"
echo "Using manual input version: $VERSION"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
echo "Using tag-based version: $VERSION"
else
VERSION=1.0.0
echo "Using default version: $VERSION"
fi
# Strip 'v' prefix if user typed it manually
VERSION=${VERSION#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- name: Install dependencies
run: npm install
- name: Update app.json version
run: |
node -e "
const fs = require('fs');
const appJson = JSON.parse(fs.readFileSync('app.json', 'utf8'));
appJson.expo.version = '${{ steps.version.outputs.version }}';
fs.writeFileSync('app.json', JSON.stringify(appJson, null, 2) + '\n');
console.log('✅ Updated app.json version to: ${{ steps.version.outputs.version }}');
"
echo "📄 Verifying app.json update:"
cat app.json | grep -A 1 '"version"'
- name: Update build.gradle version
run: |
VERSION="${{ steps.version.outputs.version }}"
VERSION_CODE=$(echo "$VERSION" | sed 's/\.//g')
echo "📝 Updating build.gradle with version: $VERSION (versionCode: $VERSION_CODE)"
sed -i "s/versionCode [0-9]*/versionCode $VERSION_CODE/" android/app/build.gradle
sed -i "s/versionName \"[^\"]*\"/versionName \"$VERSION\"/" android/app/build.gradle
echo "✅ Updated build.gradle:"
grep -A 2 "versionCode\|versionName" android/app/build.gradle
- name: Decode Keystore
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > android/app/release.keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
- name: Build Release APK
run: cd android && ./gradlew assembleRelease
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
- name: Rename APK
run: |
mv android/app/build/outputs/apk/release/app-release.apk android/app/build/outputs/apk/release/cbv-vpn-v${{ steps.version.outputs.version }}.apk
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: cbv-vpn-v${{ steps.version.outputs.version }}.apk
path: android/app/build/outputs/apk/release/cbv-vpn-v${{ steps.version.outputs.version }}.apk
retention-days: 30