2023-05-02 16:50:07 +02:00
|
|
|
name: "Release Build"
|
|
|
|
|
|
|
|
on:
|
2024-01-22 09:29:57 +01:00
|
|
|
workflow_dispatch:
|
2023-05-02 16:50:07 +02:00
|
|
|
push:
|
2024-01-22 09:29:57 +01:00
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- dev
|
2024-01-29 03:19:56 +01:00
|
|
|
paths:
|
|
|
|
- ".github/workflows/release-build.yml"
|
|
|
|
- "android/**"
|
|
|
|
- "assets/**"
|
|
|
|
- "lib/**"
|
|
|
|
- ".releaserc.*"
|
|
|
|
- "pubspec.yaml"
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-10 09:43:58 +02:00
|
|
|
- uses: actions/checkout@v4
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-10-28 16:19:07 +02:00
|
|
|
- name: Set up JDK
|
2023-12-05 03:43:04 +01:00
|
|
|
uses: actions/setup-java@v4
|
2023-05-02 16:50:07 +02:00
|
|
|
with:
|
2023-10-28 16:19:07 +02:00
|
|
|
java-version: "17"
|
2023-05-02 16:50:07 +02:00
|
|
|
distribution: "zulu"
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
- uses: subosito/flutter-action@v2
|
|
|
|
with:
|
|
|
|
channel: "stable"
|
2024-01-22 09:29:57 +01:00
|
|
|
|
|
|
|
- name: Cache Node modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
node_modules
|
|
|
|
key: npm-${{ hashFiles('package-lock.json') }}
|
|
|
|
|
|
|
|
- name: Setup semantic-release
|
|
|
|
run: npm install
|
|
|
|
|
|
|
|
- name: Get version code
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
npx semantic-release --extends ./.releaserc.getversion.json --no-ci --dry-run
|
|
|
|
echo "RELEASE_VERSION=v$(cat .VERSION)" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Bump pubspec version
|
|
|
|
run: |
|
2024-01-22 12:18:20 +01:00
|
|
|
VERSION=$(echo "${RELEASE_VERSION}" | sed 's/v//')
|
2024-01-22 23:27:33 +01:00
|
|
|
IFS='.' read -r -a nums <<< "${VERSION/-dev/}.0"
|
2024-01-22 09:29:57 +01:00
|
|
|
VERSIONCODE=$((nums[0] * 100000000 + nums[1] * 100000 + nums[2] * 100 + nums[3]))
|
2024-01-22 12:34:35 +01:00
|
|
|
sed -i "/^version/c\\version: $VERSION+$VERSIONCODE" pubspec.yaml
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
- name: Set up Flutter
|
|
|
|
run: flutter pub get
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
- name: Generate files with Builder
|
2023-11-11 11:14:54 +01:00
|
|
|
run: dart run build_runner build --delete-conflicting-outputs
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
- name: Build with Flutter
|
|
|
|
run: flutter build apk
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
- name: Sign APK
|
|
|
|
id: sign_apk
|
|
|
|
uses: ilharp/sign-android-release@v1
|
|
|
|
with:
|
|
|
|
releaseDir: build/app/outputs/apk/release
|
|
|
|
signingKey: ${{ secrets.SIGNING_KEYSTORE }}
|
|
|
|
keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
|
|
|
|
keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
|
|
|
|
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
|
2024-01-22 09:29:57 +01:00
|
|
|
|
|
|
|
- name: Rename APK
|
2024-01-22 23:27:33 +01:00
|
|
|
run: mv ${{steps.sign_apk.outputs.signedFile}} revanced-manager-${{ env.RELEASE_VERSION }}.apk
|
2024-01-22 09:29:57 +01:00
|
|
|
|
2023-05-02 16:50:07 +02:00
|
|
|
- name: Publish release APK
|
2024-01-22 09:29:57 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: npx semantic-release --extends ./.releaserc.release.json
|