update nightly build command to include production build step #19
This file contains 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: Nightly APK Build | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" # runs daily at midnight UTC (adjust as needed) | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Install Dependencies | |
run: npm install | |
- name: Decode Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/app/keystore.jks | |
mkdir android/app/app | |
echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/app/app/keystore.jks | |
- name: Build Android APK | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASS }} | |
KEY_PASSWORD: ${{ secrets.KEYSTORE_PASS }} | |
run: | | |
npm run build:android:nightly | |
# Delete previous nightly releases using GitHub CLI | |
- name: Delete Previous Nightly Releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
echo "Listing and deleting previous nightly releases" | |
for tag in $(gh release list --exclude-drafts --limit 100 | awk 'tolower($0) ~ /nightly/ {print $1}'); do | |
echo "Deleting release: $tag" | |
gh release delete "$tag" -y | |
done | |
# Create a new nightly release and upload the generated APK | |
- name: Create Nightly Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: | | |
COMMIT_ID=$(git rev-parse --short HEAD) | |
RELEASE_TAG="${COMMIT_ID}-nightly" | |
RELEASE_NAME="${COMMIT_ID}-nightly" | |
ORIGINAL_APK="android/app/build/outputs/apk/nightly/release/app-nightly-release.apk" | |
RENAMED_APK="GrooveLauncher_${RELEASE_TAG}.apk" | |
cp "$ORIGINAL_APK" "$RENAMED_APK" | |
echo "Creating release with tag $RELEASE_TAG" | |
gh release create "$RELEASE_TAG" "$RENAMED_APK" \ | |
--title "$RELEASE_NAME" \ | |
--notes "Nightly build for $(date)" \ | |
--prerelease |