Skip to content

Commit

Permalink
build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodyOG authored Dec 3, 2024
1 parent 187dad5 commit 230f70b
Showing 1 changed file with 12 additions and 33 deletions.
45 changes: 12 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: Build IceRaven Dark Theme (Auto-Release)

on:
workflow_dispatch:
schedule:
- cron: '00 0 * * *'
release:
types: [created]
branches:
- main # Or your default branch
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}
Expand All @@ -21,63 +17,46 @@ jobs:
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y wget apktool zipalign apksigner jq openjdk-17-jdk gh
sudo apt install -y wget apktool zipalign apksigner jq openjdk-17-jdk
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Get IceRaven Release Info
- name: Get Latest IceRaven ARM64 Release
id: get_release
run: |
if [[ github.event_name == 'release' ]]; then
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
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 (Manual): $LATEST_RELEASE"
else # Scheduled run, check for update
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 # Properly quoted
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))
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_OUTPUT
echo "ICERAVEN_VERSION=$(echo $LATEST_RELEASE | sed -E 's/.*iceraven-(.*)-browser.*/\1/')" >> $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 "${{ steps.get_release.outputs.LATEST_RELEASE }}"
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
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'
if: steps.get_release.outputs.ICERAVEN_VERSION != steps.latest_release.outputs.tag_name
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # Use PAT if in a fork
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # Use the PAT secret
with:
tag_name: iceraven-dark-${{ steps.get_release.outputs.ICERAVEN_VERSION }}
tag_name: ${{ 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
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
latest: true

0 comments on commit 230f70b

Please sign in to comment.