This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Android Keystore Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: 'Release tag (e.g., keystore-v1.0.0)' | |
| required: false | |
| default: 'keystore-latest' | |
| push: | |
| branches: [ master ] | |
| jobs: | |
| create-keystore-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Allow creating releases | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if keystore release exists | |
| id: check-release | |
| run: | | |
| # Check if a keystore release already exists | |
| RELEASE_EXISTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/releases" | \ | |
| jq -r '.[] | select(.tag_name | startswith("keystore-")) | .tag_name' | head -1) | |
| if [ -n "$RELEASE_EXISTS" ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Keystore release already exists: $RELEASE_EXISTS" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| echo "No keystore release found, will create new one" | |
| fi | |
| - name: Setup Java | |
| if: steps.check-release.outputs.exists == 'false' | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Create keystore | |
| if: steps.check-release.outputs.exists == 'false' | |
| run: | | |
| echo "Creating Android keystore with password: android123" | |
| keytool -genkeypair \ | |
| -v \ | |
| -keystore release.keystore \ | |
| -alias release \ | |
| -keyalg RSA \ | |
| -keysize 2048 \ | |
| -validity 10000 \ | |
| -storepass android123 \ | |
| -keypass android123 \ | |
| -dname "CN=AI Engineer Simulator, OU=Development, O=AI Engineer, L=City, ST=State, C=US" | |
| echo "Keystore created successfully" | |
| - name: Create keystore archive | |
| if: steps.check-release.outputs.exists == 'false' | |
| run: | | |
| # Create a compressed archive of the keystore | |
| tar -czf keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz release.keystore | |
| echo "Keystore archive created: keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz" | |
| - name: Create GitHub release | |
| if: steps.check-release.outputs.exists == 'false' | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.event.inputs.release_tag || 'keystore-latest' }} | |
| release_name: Android Keystore ${{ github.event.inputs.release_tag || 'Latest' }} | |
| body: | | |
| ## Android Keystore Release | |
| This release contains the Android signing keystore for the AI Engineer Job Simulator app. | |
| ### Keystore Information | |
| - **Alias**: `release` | |
| - **Key Algorithm**: RSA 2048-bit | |
| - **Validity**: 10,000 days | |
| - **Store Password**: `android123` | |
| - **Key Password**: `android123` | |
| ### Usage Instructions | |
| 1. Download `keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz` | |
| 2. Extract the keystore: `tar -xzf keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz` | |
| 3. Use in your Android build configuration: | |
| ``` | |
| storeFile file('path/to/release.keystore') | |
| storePassword 'android123' | |
| keyAlias 'release' | |
| keyPassword 'android123' | |
| ``` | |
| ### Security Notes | |
| - Store passwords securely and never commit them to version control | |
| - Keep the keystore file in a secure location | |
| - For production, consider using GitHub Secrets | |
| --- | |
| *Generated automatically by GitHub Actions* | |
| draft: false | |
| prerelease: false | |
| - name: Upload keystore to release | |
| if: steps.check-release.outputs.exists == 'false' | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz | |
| asset_name: keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz | |
| asset_content_type: application/gzip | |
| - name: Clean up keystore files | |
| if: steps.check-release.outputs.exists == 'false' | |
| run: | | |
| # Remove keystore files from workspace (they remain in the release) | |
| rm -f release.keystore keystore-${{ github.event.inputs.release_tag || 'latest' }}.tar.gz | |
| - name: Output result | |
| run: | | |
| if [ "${{ steps.check-release.outputs.exists }}" == "true" ]; then | |
| echo "✅ Keystore release already exists - no new release created" | |
| else | |
| echo "✅ Keystore created and published to release: ${{ github.event.inputs.release_tag || 'keystore-latest' }}" | |
| echo "" | |
| echo "📥 Download from: https://github.com/${{ github.repository }}/releases/tag/${{ github.event.inputs.release_tag || 'keystore-latest' }}" | |
| echo "" | |
| echo "🔐 Keystore Password: android123" | |
| echo "🔑 Key Alias: release" | |
| fi |