Build IceRaven Dark Theme (Auto-Release) #42
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: Build IceRaven Dark Theme (Auto-Release) | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 0 * * *' | |
release: | |
types: [created] | |
branches: | |
- main # Replace with your default branch if different | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y wget apktool zipalign apksigner jq openjdk-17-jdk gh | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Get IceRaven Release Info | |
id: get_release | |
run: | | |
if [[ github.event_name == 'release' ]]; then # Automated build (new release) | |
LATEST_RELEASE=$(jq -r '.assets[] | select(.name | contains("arm64") and contains("forkRelease.apk")) | .browser_download_url' < <(gh release view ${{ github.event.release.tag_name }} -R fork-maintainers/iceraven-browser --json assets)) | |
echo "ICERAVEN_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
elif [[ github.event_name == 'workflow_dispatch' ]]; then # Manual Trigger | |
LATEST_RELEASE=$(jq -r '.assets[] | select(.name | contains("arm64") and contains("forkRelease.apk")) | .browser_download_url' < <(curl -s https://api.github.com/repos/fork-maintainers/iceraven-browser/releases/latest)) | |
ICERAVEN_VERSION=$(echo $LATEST_RELEASE | sed -E 's/.*iceraven-(.*)-browser.*/\1/') | |
echo "ICERAVEN_VERSION=$ICERAVEN_VERSION" >> $GITHUB_OUTPUT | |
echo $LATEST_RELEASE # Print the latest release URL for debugging | |
else # Scheduled run, check for new release | |
LATEST_RELEASE=$(jq -r '.assets[] | select(.name | contains("arm64") and contains("forkRelease.apk")) | .browser_download_url' < <(curl -s https://api.github.com/repos/fork-maintainers/iceraven-browser/releases/latest)) | |
CURRENT_VERSION=$(jq -r '.tag_name' < <(curl -s https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest)) | |
ICERAVEN_VERSION=$(echo $LATEST_RELEASE | sed -E 's/.*iceraven-(.*)-browser.*/\1/') | |
echo "ICERAVEN_VERSION=$ICERAVEN_VERSION" >> $GITHUB_OUTPUT | |
if [[ "$ICERAVEN_VERSION" == "$CURRENT_VERSION" ]]; then | |
echo "No new IceRaven release found. Skipping." | |
exit 0 | |
fi | |
fi | |
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_OUTPUT | |
- name: Download Latest APK | |
run: | | |
wget -q "${{ steps.get_release.outputs.LATEST_RELEASE }}" -O iceraven.apk | |
- name: Run Build Script | |
run: bash build.sh | |
- name: Sign APK | |
run: | | |
echo "${{ secrets.KEYSTORE }}" | base64 -di > keystore.jks | |
apksigner sign --ks keystore.jks --ks-pass pass:${{ secrets.KEYSTORE_PASSPHRASE }} --key-pass pass:${{ secrets.KEY_PASSWORD }} iceraven-patched-signed.apk | |
- name: Upload APK as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: iceraven-dark-apk | |
path: iceraven-patched-signed.apk | |
- name: Create Release (if new version) | |
id: create_release | |
if: github.event_name == 'release' | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # Use PAT if in a fork | |
with: | |
tag_name: iceraven-dark-${{ steps.get_release.outputs.ICERAVEN_VERSION }} | |
files: iceraven-patched-signed.apk | |
- name: Get latest release info | |
id: latest_release | |
if: steps.create_release.outcome == 'success' | |
uses: cardinalby/git-get-release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # Use PAT if in fork | |
with: | |
latest: true |