diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 0000000000..f13b9386ca --- /dev/null +++ b/.github/workflows/clean.yml @@ -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-22.04 + 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 }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6081405851..66879c9350 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,12 @@ name: Release on: + workflow_call: workflow_dispatch: push: branches: - main + - revanced-extended - dev jobs: diff --git a/.github/workflows/sync_upstream.yml b/.github/workflows/sync_upstream.yml new file mode 100644 index 0000000000..20a4700234 --- /dev/null +++ b/.github/workflows/sync_upstream.yml @@ -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 '77761710+E85Addict@users.noreply.github.com' + 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/revanced-extended...remotes/upstream/revanced-extended | awk '{print$2}') + echo "Ahead $C commits." + if [ "$C" -gt 0 ]; then + echo "Rebasing" + # git push origin --delete $T + git rebase -X ours upstream/revanced-extended + 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 \ No newline at end of file diff --git a/.releaserc b/.releaserc index 0abaf5291b..f9e4e155ff 100644 --- a/.releaserc +++ b/.releaserc @@ -1,6 +1,7 @@ { "branches": [ "main", + "revanced-extended", { "name": "dev", "prerelease": true @@ -14,7 +15,6 @@ ] } ], - "@semantic-release/release-notes-generator", "@semantic-release/changelog", "gradle-semantic-release-plugin", [ @@ -26,7 +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'" } ], [ @@ -42,13 +42,6 @@ ], successComment: false } - ], - [ - "@saithodev/semantic-release-backmerge", - { - backmergeBranches: [{"from": "main", "to": "dev"}], - clearWorkspace: true - } ] ] } diff --git a/patches/build.gradle.kts b/patches/build.gradle.kts index 27f36e191a..5b7367972c 100644 --- a/patches/build.gradle.kts +++ b/patches/build.gradle.kts @@ -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") - } - } - } } \ No newline at end of file