Skip to content

Commit

Permalink
perf: Add upstream sync
Browse files Browse the repository at this point in the history
  • Loading branch information
E85Addict committed Jan 4, 2025
1 parent 697a519 commit 79d513d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 23 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Delete old workflow runs
on:
workflow_dispatch:
inputs:
days:
description: 'Number of days.'
required: true
default: 0
minimum_runs:
description: 'The minimum runs to keep for each workflow.'
required: true
default: 0
delete_workflow_pattern:
description: 'The name of the workflow. if not set then it will target all workflows.'
required: false

jobs:
del_runs:
runs-on: ubuntu-latest
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GH_PAT }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Release

on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
- revanced-extended
- dev

jobs:
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/sync_upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Sync upstream
on:
workflow_call:
workflow_dispatch:
schedule:
- cron: "0 */8 * * *"

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}

- name: sync
id: sync
shell: bash
run: |
git config --global user.name 'E85Addict'
git config --global user.email '[email protected]'
if [[ $(git log | grep Author | head -1) == *"semantic"* ]]; then
git reset --hard HEAD~1
fi
T=$(git tag --sort=creatordate | tail -1)
git remote add upstream https://github.com/inotia00/revanced-patches
git tag -d $(git tag -l)
git fetch upstream --tags -f
LatestRemoteTag=$(curl -s https://api.github.com/repos/inotia00/revanced-patches/releases/latest | jq -r '.tag_name')
C=$(git rev-list --left-right --count origin/dev...remotes/upstream/dev | awk '{print$2}')
echo "Ahead $C commits."
if [ "$C" -gt 0 ]; then
echo "Rebasing"
# git push origin --delete $T
git rebase -X ours upstream/dev
git push --tags -f
git push origin --delete $LatestRemoteTag
git push -f
else
echo "in sync"
fi
- name: Delete old workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GH_PAT }}
repository: ${{ github.repository }}
retain_days: 0
keep_minimum_runs: 10
12 changes: 2 additions & 10 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"branches": [
"main",
"revanced-extended",
{
"name": "dev",
"prerelease": true
Expand All @@ -14,7 +15,6 @@
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"gradle-semantic-release-plugin",
[
Expand All @@ -26,8 +26,7 @@
"gradle.properties",
"patches.json",
],
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n'Add upstream sync'" }
],
[
"@semantic-release/github",
Expand All @@ -42,13 +41,6 @@
],
successComment: false
}
],
[
"@saithodev/semantic-release-backmerge",
{
backmergeBranches: [{"from": "main", "to": "dev"}],
clearWorkspace: true
}
]
]
}
13 changes: 0 additions & 13 deletions patches/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,4 @@ kotlin {
compilerOptions {
freeCompilerArgs = listOf("-Xcontext-receivers")
}
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/inotia00/revanced-patches")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

0 comments on commit 79d513d

Please sign in to comment.