Skip to content

Commit

Permalink
Add a scheduled job that updates public suffix list periodically (lin…
Browse files Browse the repository at this point in the history
…e#3590)

Motivation:

Public Suffix List is automatically updated when building projects.
It should be inefficient to update the public_suffixes.txt on every PR.
Additionally, the unexpectedly updated file makes contributors embarrassed.
We've repeatedly explained why the file was changed to them. line#3546

Modifications:

- Remove `PublicSuffixesTask` dependency from build phases.
- Add a GitHub Actions job that schedules to update the public suffix list 
  every day.

Result:

- Improved build process and less noise in PR diffs
- Fixes line#3546
  • Loading branch information
ikhoon authored Jun 5, 2021
1 parent fc04cbf commit 22bcfb0
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,3 @@
*.woff2 binary
*.xz binary
*.zip binary

# Collapse generated code in diffs
public_suffixes.txt linguist-generated
59 changes: 59 additions & 0 deletions .github/workflows/public-suffixes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Update Public Suffix List
on:
schedule:
- cron: '0 10 * * *'

jobs:
update-psl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- id: setup-jdk-15
name: Set up JDK 15
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '15'

- name: Restore Gradle Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/wrapper/dists
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2
~/.gradle/caches/package-lists
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace :core:publicSuffixes
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
git-user-signingkey: true
git-commit-gpgsign: true

- name: Push updated public suffix list
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_options: '-S'
commit_message: Update public suffix list
file_pattern: core/src/main/resources/com/linecorp/armeria/public_suffixes.txt
commit_user_name: Meri Kim
commit_user_email: [email protected]
commit_author: Meri Kim <[email protected]>

- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock || true
rm -f ~/.gradle/caches/modules-2/gc.properties || true
shell: bash
2 changes: 0 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,3 @@ class PublicSuffixesTask extends DefaultTask {
}

task publicSuffixes(type: PublicSuffixesTask)
tasks.processResources.dependsOn publicSuffixes
tasks.classes.dependsOn publicSuffixes

0 comments on commit 22bcfb0

Please sign in to comment.