mirror of
https://github.com/jwinterm/grim.git
synced 2026-10-17 14:21:24 +02:00
228 lines
8.3 KiB
YAML
228 lines
8.3 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags-ignore:
|
|
- "*-dev*"
|
|
|
|
jobs:
|
|
version:
|
|
runs-on: ubuntu
|
|
outputs:
|
|
v: ${{ steps.version.outputs.v }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
ver="$(grep -m 1 -Po 'version = "\K[^"]*' Cargo.toml)"
|
|
[[ $ver == *"-dev"* ]] && ver=${ver} || ver=${ver}-dev
|
|
[[ ${{ forgejo.ref_type }} == 'tag' ]] && app_ver=${{ forgejo.ref_name }} || app_ver=v${ver}
|
|
echo "v=${app_ver}" >> "$FORGEJO_OUTPUT"
|
|
echo $app_ver
|
|
[[ ${{ forgejo.ref_type }} == 'tag' ]] && pre=false || pre=true
|
|
echo "pre=${pre}" >> "$FORGEJO_OUTPUT"
|
|
echo "pre-release: ${pre}"
|
|
- name: Check existing release
|
|
if: ${{ forgejo.ref_type == 'tag' }}
|
|
id: check
|
|
run: |
|
|
git fetch --tags
|
|
dev_sha=$(git rev-parse refs/tags/${{ forgejo.ref_name }}-dev)
|
|
[[ "$(git show-ref)" == *"${dev_sha}"* ]] && exists='true' || exists='false'
|
|
echo "exists=${exists}" >> "$FORGEJO_OUTPUT"
|
|
echo ${exists}
|
|
mkdir release
|
|
- uses: ardocrat/forgejo-release@grim
|
|
if: ${{ forgejo.ref_type == 'tag' && steps.check.outputs.exists == 'true' }}
|
|
with:
|
|
direction: download
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|
|
tag: "${{ forgejo.ref_name }}-dev"
|
|
release-dir: ./release
|
|
- name: Rename files
|
|
if: ${{ forgejo.ref_type == 'tag' && steps.check.outputs.exists == 'true' }}
|
|
working-directory: release
|
|
run: for f in *; do mv "$f" "$(echo "$f" | sed s/-dev-/-/)"; done
|
|
- uses: ardocrat/forgejo-release@grim
|
|
if: ${{ forgejo.ref_type == 'tag' && steps.check.outputs.exists == 'true' }}
|
|
with:
|
|
direction: upload
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|
|
tag: ${{ forgejo.ref_name }}
|
|
override: false
|
|
prerelease: false
|
|
release-dir: ./release
|
|
release-notes: ""
|
|
|
|
android_libs:
|
|
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
|
runs-on: ubuntu
|
|
needs: version
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- name: Build libs
|
|
run: |
|
|
chmod +x scripts/android.sh && ./scripts/android.sh lib ${{ needs.version.outputs.v }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: libs_android
|
|
path: android/app/src/main/jniLibs/*
|
|
|
|
android_release:
|
|
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
|
runs-on: ubuntu-android
|
|
needs: [version, android_libs]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- run: mkdir libs
|
|
- name: Download Libs Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: libs
|
|
pattern: libs_*
|
|
merge-multiple: true
|
|
- name: Setup Java build
|
|
run: |
|
|
chmod +x android/gradlew
|
|
echo "${{ secrets.ANDROID_KEYSTORE }}" > release.keystore.txt
|
|
base64 -d release.keystore.txt > android/keystore
|
|
echo "${{ secrets.ANDROID_KEYSTORE_PROPS }}" > release.keystore.props.txt
|
|
base64 -d release.keystore.props.txt > android/keystore.properties
|
|
- name: Prepare build
|
|
run: |
|
|
mkdir release
|
|
chmod +x android/gradlew
|
|
- name: Release ARMv7+v8 APK
|
|
working-directory: android
|
|
run: |
|
|
jni_path=app/src/main/jniLibs
|
|
mkdir ${jni_path}
|
|
mv ../libs/armeabi-v7a ${jni_path}
|
|
mv ../libs/arm64-v8a ${jni_path}
|
|
./gradlew assembleSignedRelease
|
|
apk_path=app/build/outputs/apk/signedRelease/app-signedRelease.apk
|
|
name=grim-${{ needs.version.outputs.v }}-android.apk
|
|
mv ${apk_path} "${name}"
|
|
- name: Checksum ARM APK
|
|
working-directory: android
|
|
run: |
|
|
name=grim-${{ needs.version.outputs.v }}-android.apk
|
|
checksum=grim-${{ needs.version.outputs.v }}-android-sha256sum.txt
|
|
sha256sum "${name}" > "${checksum}"
|
|
- name: Release x86_64 APK
|
|
working-directory: android
|
|
run: |
|
|
./gradlew clean
|
|
jni_path=app/src/main/jniLibs
|
|
rm -rf ${jni_path}/*
|
|
mv ../libs/x86_64 ${jni_path}
|
|
./gradlew assembleSignedRelease
|
|
apk_path=app/build/outputs/apk/signedRelease/app-signedRelease.apk
|
|
name=grim-${{ needs.version.outputs.v }}-android-x86_64.apk
|
|
mv ${apk_path} "${name}"
|
|
- name: Checksum x86_64 APK
|
|
working-directory: android
|
|
run: |
|
|
name=grim-${{ needs.version.outputs.v }}-android.apk
|
|
checksum=grim-${{ needs.version.outputs.v }}-android-x86_64-sha256sum.txt
|
|
sha256sum "${name}" > "${checksum}"
|
|
- run: mv android/grim* release
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release_android
|
|
path: release/*
|
|
|
|
linux:
|
|
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
|
runs-on: ubuntu
|
|
needs: [version, android_libs, android_release]
|
|
uses: ./.forgejo/workflows/linux.yaml
|
|
with:
|
|
version: ${{ needs.version.outputs.v }}
|
|
secrets:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
macos:
|
|
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
|
runs-on: ubuntu
|
|
needs: [version, android_libs, android_release, linux]
|
|
uses: ./.forgejo/workflows/macos.yaml
|
|
with:
|
|
version: ${{ needs.version.outputs.v }}
|
|
secrets:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
windows:
|
|
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
|
runs-on: ubuntu
|
|
needs: [version, android_libs, android_release, linux, macos]
|
|
uses: ./.forgejo/workflows/windows.yaml
|
|
with:
|
|
version: ${{ needs.version.outputs.v }}
|
|
secrets:
|
|
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
release:
|
|
if: ${{ forgejo.ref_type == 'branch' || needs.check.outputs.exists == 'false' }}
|
|
runs-on: ubuntu
|
|
needs: [version, android_libs, android_release, linux, macos, windows]
|
|
steps:
|
|
- run: mkdir release
|
|
- name: Download All Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: release
|
|
pattern: release_*
|
|
merge-multiple: true
|
|
- name: Upload release to Forgejo
|
|
uses: ardocrat/forgejo-release@grim
|
|
with:
|
|
direction: upload
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|
|
tag: ${{ needs.version.outputs.v }}
|
|
override: true
|
|
prerelease: ${{ needs.version.outputs.pre }}
|
|
release-dir: release
|
|
release-notes: ""
|
|
- name: Telegram Notify Channel
|
|
if: always()
|
|
uses: actions/telegram-notifier@ardocrat
|
|
with:
|
|
api_url: ${{ secrets.TELEGRAM_API_URL }}
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
chat_id: ${{ secrets.TELEGRAM_CHANNEL_ID }}
|
|
status: ${{ job.status }}
|
|
notify_fields: "actor,repository,workflow,branch,commit"
|
|
- name: Telegram Notify Group
|
|
if: always()
|
|
uses: actions/telegram-notifier@ardocrat
|
|
with:
|
|
api_url: ${{ secrets.TELEGRAM_API_URL }}
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
chat_id: ${{ secrets.TELEGRAM_GROUP_ID }}
|
|
status: ${{ job.status }}
|
|
notify_fields: "actor,repository,workflow,branch,commit"
|
|
- name: Upload files to Telegram
|
|
uses: ardocrat/tg-send-file-action@main
|
|
with:
|
|
api_url: ${{ secrets.TELEGRAM_API_URL }}
|
|
chat_ids: |
|
|
${{ secrets.TELEGRAM_GROUP_ID }}
|
|
${{ secrets.TELEGRAM_CHANNEL_ID }}
|
|
body: "🎁 Release ${{ needs.version.outputs.v }} is ready!"
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
pin: true
|
|
files: |
|
|
release/grim-${{ needs.version.outputs.v }}-android.apk
|
|
release/grim-${{ needs.version.outputs.v }}-android-x86_64.apk
|
|
release/grim-${{ needs.version.outputs.v }}-linux-arm.AppImage
|
|
release/grim-${{ needs.version.outputs.v }}-linux-x86_64.AppImage
|
|
release/grim-${{ needs.version.outputs.v }}-macos.zip
|
|
release/grim-${{ needs.version.outputs.v }}-win-x86_64.zip |