-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for Differential Updates
- Loading branch information
1 parent
27e293e
commit d5c3411
Showing
12 changed files
with
216 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Delete old workflow runs | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
delete: | ||
name: Delete workflow runs 🗑️ | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
steps: | ||
- name: Start cleanup | ||
uses: Mattraks/delete-workflow-runs@4c9f24749b7996562658e3d6e10662489e22caca # v2 | ||
with: | ||
token: ${{ github.token }} | ||
repository: ${{ github.repository }} | ||
retain_days: 0 | ||
keep_minimum_runs: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Deploy | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
previous_sha: | ||
required: true | ||
type: string | ||
description: 'Previous commit SHA' | ||
current_sha: | ||
required: true | ||
type: string | ||
description: 'Current commit SHA' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
find-changes: | ||
name: Find changed lists 🕵️ | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 5 | ||
|
||
- name: Find changed lists | ||
id: find-changes | ||
run: | | ||
changed_lists=$(git diff --name-only "${{ inputs.previous_sha }}" "${{ inputs.current_sha }}" | grep '^filters/' | cut -d/ -f2 | sort -u | jq -R -s -c 'split("\n") | map(select(. != ""))') | ||
if [[ -z "$changed_lists" || "$changed_lists" == "[]" ]]; then | ||
echo "No changes detected." | ||
echo "changed_lists=[]" >> $GITHUB_ENV | ||
else | ||
echo "changed_lists=$changed_lists" >> $GITHUB_ENV | ||
fi | ||
echo "::set-output name=changed_lists::$changed_lists" | ||
outputs: | ||
changed_lists: ${{ steps.find-changes.outputs.changed_lists }} | ||
|
||
deploy: | ||
name: Deploy 🚀 | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
needs: find-changes | ||
if: ${{ needs.find-changes.outputs.changed_lists != '[]' }} | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
list: ${{ fromJson(needs.find-changes.outputs.changed_lists) }} | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 2 | ||
ref: main | ||
|
||
- run: corepack enable | ||
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile --prefer-offline | ||
|
||
- name: Build filters | ||
run: pnpm run build -l ${{ matrix.list }} | ||
|
||
- name: Checkout deploy branch | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 2 | ||
ref: deploy | ||
path: deploy-branch | ||
|
||
- name: Backup old list | ||
run: mkdir -p old && cp deploy-branch/${{ matrix.list }}.txt old/${{ matrix.list }}.txt | ||
|
||
- name: Move over new list | ||
run: cp out/${{ matrix.list }}.txt deploy-branch/${{ matrix.list }}.txt | ||
|
||
- name: Use diff-builder | ||
run: | | ||
patch_name=$(echo ${{ matrix.list }} | tr '[:upper:]' '[:lower:]')_$(echo ${{ inputs.current_sha }} | cut -c1-8) | ||
mkdir -p deploy-branch/patches/${{ matrix.list }} | ||
pnpm exec diff-builder build -c -v -n "$patch_name" -t 24 old/${{ matrix.list }}.txt deploy-branch/${{ matrix.list }}.txt deploy-branch/patches/${{ matrix.list }} | ||
- name: Commit and push changes | ||
run: | | ||
cd deploy-branch | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
git add patches/ | ||
git add ads.txt annoyances.txt tracking.txt | ||
git commit -m "Deployment of ${{ matrix.list }}" | ||
git push origin deploy |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Test 🧪 | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- run: corepack enable | ||
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile --prefer-offline | ||
|
||
- name: Setup Biome | ||
uses: biomejs/setup-biome@1cbe33ead22c7a2fded3b52fa2893611c815c9b5 # v2 | ||
|
||
- name: Run filters lint | ||
run: pnpm run lint:filters | ||
|
||
- name: Run Biome | ||
run: biome ci . --reporter=github | ||
|
||
- name: Validate codeowners | ||
run: pnpm run codeowners:check | ||
|
||
- name: Build filters | ||
run: pnpm run build | ||
|
||
attempt_deploy: | ||
name: Attempt deploy 🔭 | ||
needs: test | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
uses: ./.github/workflows/deploy.yml | ||
secrets: inherit | ||
with: | ||
previous_sha: ${{ github.event.before }} | ||
current_sha: ${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,3 @@ | |
||shopgun.com^$third-party | ||
||raygun.io$third-party | ||
||piano.io^$third-party | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.