Daily list sync #1083
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
name: Daily list sync | |
on: | |
schedule: | |
- cron: "30 15 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "^1.15.5" | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
- name: Generate new list | |
run: go run tools/generate-list/main.go | |
- name: Test | |
run: go test ./... | |
- name: Check for list changes | |
continue-on-error: true | |
id: changes | |
run: git update-index --refresh && git diff-index HEAD | |
- name: Dump steps context | |
env: | |
STEPS_CONTEXT: ${{ toJson(steps) }} | |
run: echo "$STEPS_CONTEXT" | |
- name: Generate new readme | |
if: steps.changes.outcome != 'success' | |
run: go run tools/generate-readme/main.go | |
- name: Commit changes | |
if: steps.changes.outcome != 'success' | |
run: | | |
git checkout main -- | |
git config user.email "johan@lindell.me" | |
git config user.name "Johan Lindell" | |
git add README.md | |
git add burner/ | |
git commit -m "chore: updated domain list" | |
- name: Bump version | |
if: steps.changes.outcome != 'success' | |
run: | | |
CURRENT_TAG=`git describe --tags --abbrev=0` | |
NEW_PATCH=`echo $CURRENT_TAG | sed -E 's/v[0-9]+\.[0-9]+\.([0-9]+)/\1+1/' | bc` | |
NEW_TAG=`echo $CURRENT_TAG | sed -E "s/(v[0-9]+\.[0-9]+\.)[0-9]+/\1$NEW_PATCH/"` | |
git tag -a $NEW_TAG -m $NEW_TAG | |
- name: Push changes | |
if: steps.changes.outcome != 'success' | |
run: | | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git push --follow-tags |