mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 05:54:26 +02:00
ci: Modernize workflows (#2473)
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
This commit is contained in:
parent
a8a4ffabed
commit
062f28387f
85
.github/workflows/build_pull_request.yml
vendored
85
.github/workflows/build_pull_request.yml
vendored
@ -3,42 +3,18 @@ name: Build pull request
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
# Select pull request
|
|
||||||
pr-number:
|
pr-number:
|
||||||
description: PR number (Without hashtag)
|
description: PR number
|
||||||
required: true
|
required: true
|
||||||
# Select app flavor
|
|
||||||
app-flavor:
|
app-flavor:
|
||||||
description: App flavor
|
description: App flavor
|
||||||
default: 'release'
|
default: release
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- release
|
- release
|
||||||
- debug
|
- debug
|
||||||
- profile
|
- profile
|
||||||
|
|
||||||
# Flutter Configurations,
|
|
||||||
# it's recommended to be set when you have problem regarding with flutter itself
|
|
||||||
# For most part you do not need to change this.
|
|
||||||
|
|
||||||
# Flutter version to use, note that the version had to exist in whether channel
|
|
||||||
# to grab
|
|
||||||
# Try using exact version or particular version on a specific branch instead of "any"
|
|
||||||
flutter-channel:
|
|
||||||
description: Flutter channel
|
|
||||||
default: 'stable'
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- stable
|
|
||||||
- beta
|
|
||||||
- dev
|
|
||||||
- any
|
|
||||||
flutter-version:
|
|
||||||
description: Flutter version
|
|
||||||
default: '3.29.x'
|
|
||||||
|
|
||||||
run-name: "Build pull request ${{ inputs.pr-number }}"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
@ -62,76 +38,27 @@ jobs:
|
|||||||
- name: Set up Flutter
|
- name: Set up Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: ${{ inputs.flutter-channel }}
|
channel: stable
|
||||||
flutter-version: ${{ inputs.flutter-version }}
|
|
||||||
|
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
continue-on-error: true
|
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Generate translations
|
- name: Generate translations
|
||||||
continue-on-error: true
|
|
||||||
run: dart run slang
|
run: dart run slang
|
||||||
|
|
||||||
- name: Generate code files
|
- name: Generate code files
|
||||||
continue-on-error: true
|
|
||||||
run: dart run build_runner build --delete-conflicting-outputs
|
run: dart run build_runner build --delete-conflicting-outputs
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
continue-on-error: true
|
|
||||||
id: flutter-build
|
id: flutter-build
|
||||||
run: flutter build apk --${{ inputs.app-flavor }}
|
run: flutter build apk --${{ inputs.app-flavor }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Prepare comment
|
- name: Upload artifacts
|
||||||
id: prepare-comment # This should work now?
|
|
||||||
run: |
|
|
||||||
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
|
||||||
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
|
|
||||||
MESSAGE="✅ Succeeded build on $COMMIT_HASH."
|
|
||||||
else
|
|
||||||
MESSAGE="🚫 Failed build on $COMMIT_HASH."
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: "Comment on pull request #${{ inputs.pr-number }}"
|
|
||||||
uses: thollander/actions-comment-pull-request@v3
|
|
||||||
with:
|
|
||||||
github-token: ${{ github.token }}
|
|
||||||
pr-number: ${{ inputs.pr-number }}
|
|
||||||
mode: recreate
|
|
||||||
comment-tag: execution
|
|
||||||
message: |
|
|
||||||
## ⚒️ Build status
|
|
||||||
|
|
||||||
🧪 Workflow triggered by: ${{ github.actor }}
|
|
||||||
|
|
||||||
${{ steps.prepare-comment.outputs.MESSAGE }}
|
|
||||||
|
|
||||||
Details: [_Job execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**_](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
|
|
||||||
|
|
||||||
### ⚙️ Workflow Steps
|
|
||||||
|
|
||||||
| Step | Status |
|
|
||||||
| :------------------------ | :------------------------------------------------------- |
|
|
||||||
| **Get dependencies** | ${{ steps.get-dependencies.outcome || job.status }} |
|
|
||||||
| **Generate translations** | ${{ steps.generate-translations.outcome || job.status }} |
|
|
||||||
| **Generate code files** | ${{ steps.generate-code-files.outcome || job.status }} |
|
|
||||||
| **Build** | ${{ steps.flutter-build.outcome }} |
|
|
||||||
|
|
||||||
### ⚙️ Workflow Configuration
|
|
||||||
|
|
||||||
| Parameter | Value |
|
|
||||||
| :--------------- | :--------------------------------------- |
|
|
||||||
| App flavor | ${{ inputs.app-flavor }} |
|
|
||||||
| Flutter version | ${{ inputs.flutter-version }} |
|
|
||||||
| Flutter channel | ${{ inputs.flutter-channel }} |
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
if: steps.flutter-build.outcome == 'success'
|
if: steps.flutter-build.outcome == 'success'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavor }}-${{ inputs.flutter-version }})
|
name: revanced-manager-(${{ env.COMMIT_HASH }}
|
||||||
path: |
|
path: |
|
||||||
build/app/outputs/flutter-apk/app-${{ inputs.app-flavor }}.apk
|
build/app/outputs/flutter-apk/app-*.apk
|
||||||
build/app/outputs/flutter-apk/app-${{ inputs.app-flavor }}.apk.sha1
|
|
||||||
|
3
.github/workflows/open_pull_request.yml
vendored
3
.github/workflows/open_pull_request.yml
vendored
@ -12,6 +12,8 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
pull-request:
|
pull-request:
|
||||||
name: Open pull request
|
name: Open pull request
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -25,4 +27,3 @@ jobs:
|
|||||||
pr_body: |
|
pr_body: |
|
||||||
This pull request will ${{ env.MESSAGE }}.
|
This pull request will ${{ env.MESSAGE }}.
|
||||||
pr_draft: true
|
pr_draft: true
|
||||||
github_token: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
|
||||||
|
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
@ -6,19 +6,13 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
paths:
|
|
||||||
- ".github/workflows/release.yml"
|
|
||||||
- "android/**"
|
|
||||||
- "assets/**"
|
|
||||||
- "lib/**"
|
|
||||||
- "pubspec.yaml"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
|
||||||
contents: write
|
contents: write
|
||||||
|
id-token: write
|
||||||
attestations: write
|
attestations: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -28,7 +22,10 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@ -40,6 +37,10 @@ jobs:
|
|||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
channel: stable
|
channel: stable
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -57,17 +58,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.KEYSTORE }}" | base64 --decode > "android/app/keystore.jks"
|
echo "${{ secrets.KEYSTORE }}" | base64 --decode > "android/app/keystore.jks"
|
||||||
|
|
||||||
- name: Release
|
- name: Semantic Release
|
||||||
|
uses: cycjimmy/semantic-release-action@v4
|
||||||
|
id: semantic
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||||
KEYSTORE_ENTRY_ALIAS: ${{ secrets.KEYSTORE_ENTRY_ALIAS }}
|
KEYSTORE_ENTRY_ALIAS: ${{ secrets.KEYSTORE_ENTRY_ALIAS }}
|
||||||
KEYSTORE_ENTRY_PASSWORD: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }}
|
KEYSTORE_ENTRY_PASSWORD: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }}
|
||||||
run: |
|
|
||||||
npx semantic-release
|
|
||||||
|
|
||||||
- name: Generate artifact attestation
|
- name: Attest
|
||||||
if: github.ref == 'refs/heads/main'
|
if: steps.semantic.outputs.new_release_published == 'true'
|
||||||
uses: actions/attest-build-provenance@v1
|
uses: actions/attest-build-provenance@v2
|
||||||
with:
|
with:
|
||||||
subject-path: build/app/outputs/apk/release/revanced-manager-*.apk
|
subject-path: build/app/outputs/apk/release/revanced-manager-*.apk
|
||||||
|
Loading…
x
Reference in New Issue
Block a user