Nightly Release #267
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 Release | |
on: | |
schedule: | |
- cron: "0 0 * * *" # This runs at midnight UTC every day | |
workflow_dispatch: # This allows the workflow to be triggered manually | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out the repository | |
uses: actions/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Delete existing nightly release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
release_id=$(curl -sSf -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/nightly" | jq -r '.id') | |
if [ -n "$release_id" ]; then | |
# Delete the release | |
curl -sSf \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-X DELETE \ | |
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${release_id}" | |
# Delete the tag | |
curl -sSf \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-X DELETE \ | |
"https://api.github.com/repos/${GITHUB_REPOSITORY}/git/refs/tags/nightly" | |
fi | |
build: | |
name: Build, Sign & Release | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Checkout project | |
uses: actions/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: set up JDK 17 | |
uses: actions/[email protected] | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
cache: gradle | |
- uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Get weather.properties from secrets | |
run: printf "%s" "${{ secrets.WEATHER_PROPERTIES }}" > $GITHUB_WORKSPACE/weather.properties | |
- name: Build with Gradle | |
run: ./gradlew clean && ./gradlew assembleWithInternetNightlyRelease && ./gradlew assembleWithoutInternetNightlyRelease | |
- name: Sign APK - WithInternet | |
uses: ilharp/[email protected] | |
# ID used to access action output | |
id: sign_app_withInternet | |
with: | |
releaseDir: app/build/outputs/apk/withInternetNightly/release | |
signingKey: ${{ secrets.SIGNINGKEY_BASE64 }} | |
keyAlias: ${{ secrets.KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
buildToolsVersion: 35.0.0 | |
- name: Sign APK - WithoutInternet | |
uses: ilharp/[email protected] | |
# ID used to access action output | |
id: sign_app_withoutInternet | |
with: | |
releaseDir: app/build/outputs/apk/withoutInternetNightly/release | |
signingKey: ${{ secrets.SIGNINGKEY_BASE64 }} | |
keyAlias: ${{ secrets.KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
buildToolsVersion: 35.0.0 | |
- name: Extract Version | |
id: extract_version | |
run: | | |
version=$(date +"%Y.%m.%d") | |
echo "version=$version" >> $GITHUB_ENV | |
shell: bash | |
- name: Rename files | |
run: | | |
mkdir -p ./build/release/ | |
mv ${{steps.sign_app_withInternet.outputs.signedFile}} ./build/release/EasyLauncher-Internet-Nightly-Signed.apk | |
mv ${{steps.sign_app_withoutInternet.outputs.signedFile}} ./build/release/EasyLauncher-Nightly-Signed.apk | |
shell: bash | |
- name: Create and Upload Release | |
uses: softprops/[email protected] | |
with: | |
tag_name: nightly | |
name: Nightly Release ${{ env.version }} | |
body: "![GitHub Downloads (total, specific tag)](https://img.shields.io/github/downloads/DroidWorksStudio/EasyLauncher/nightly/total)" | |
append_body: false | |
files: | | |
./build/release/EasyLauncher-Internet-Nightly-Signed.apk | |
./build/release/EasyLauncher-Nightly-Signed.apk | |
prerelease: true | |
generate_release_notes: true | |
env: | |
version: ${{ env.version }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |