From c7d351383d2b4744ceab20bdfaaedac70587ceb4 Mon Sep 17 00:00:00 2001 From: dolfinus Date: Fri, 26 Mar 2021 00:13:15 +0300 Subject: [PATCH 1/2] Automatically update emails list --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ .github/workflows/sync.yml | 44 +++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..950d465 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Releases + +on: + workflow_dispatch: + #push: + # tags: + # - .* + +jobs: + release: + name: Release new version + runs-on: ubuntu-latest + + steps: + - name: Wait for tests + uses: fountainhead/action-wait-for-check@v1.0.0 + id: wait-for-tests + with: + token: ${{ secrets.GITHUB_TOKEN }} + checkName: Run dialyzer + ref: ${{ github.ref }} + timeoutSeconds: 3600 + + - name: Set up Elixir + uses: erlef/setup-elixir@v1 + with: + otp-version: "22.2" + elixir-version: "1.9.4" + + - name: Checkout + uses: actions/checkout@v2 + + - name: Cache deps + id: cache-deps + uses: actions/cache@v2 + with: + path: | + deps + _build + key: deps-${{ runner.os }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} + restore-keys: | + deps-${{ runner.os }}-${{ hashFiles('**/mix.lock') }} + deps-${{ runner.os }}-$ + + - name: Install package dependencies + run: mix deps.get + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Publish hex package + run: mix hex.publish --yes + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..a2c1f19 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,44 @@ +name: Daily list sync + +on: + schedule: + - cron: "30 15 * * *" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download new list + run: ./update_providers.sh + + - name: Check for list changes + continue-on-error: true + id: changes + run: git update-index --refresh && git diff-index HEAD + + - name: Commit changes + if: steps.changes.outcome != 'success' + run: | + git checkout main -- + git config user.email "benjamin@opencollective.com" + git config user.name "Burnex Bot" + git add priv/burner-email-providers/emails.txt + + - name: Bump version + if: steps.changes.outcome != 'success' + run: | + CURRENT_VERSION=`cat VERSION` + 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/"` + echo $NEW_TAG > VERSION + git commit -m "chore: updated domain list" + git tag -a $NEW_TAG -m $NEW_TAG + + - name: Push changes + if: steps.changes.outcome != 'success' + run: | + git push --follow-tags \ No newline at end of file From 982a0ed744907d6b6d5bdcb5ba6f785d41e9162b Mon Sep 17 00:00:00 2001 From: dolfinus Date: Sun, 31 Oct 2021 14:11:04 +0300 Subject: [PATCH 2/2] Update workflow --- .github/workflows/release.yml | 16 ++++++---------- .github/workflows/sync.yml | 26 ++++++++++++++++++++------ .github/workflows/test.yml | 17 +++++++++++++++-- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 950d465..7802d9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,9 @@ name: Releases on: - workflow_dispatch: - #push: - # tags: - # - .* + push: + tags: + - .* jobs: release: @@ -17,7 +16,7 @@ jobs: id: wait-for-tests with: token: ${{ secrets.GITHUB_TOKEN }} - checkName: Run dialyzer + checkName: All done ref: ${{ github.ref }} timeoutSeconds: 3600 @@ -47,12 +46,9 @@ jobs: - name: Create release id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + token: ${{ secrets.PERSONAL_TOKEN }} draft: false prerelease: false diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index a2c1f19..04bfa89 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -1,6 +1,7 @@ name: Daily list sync on: + workflow_dispatch: schedule: - cron: "30 15 * * *" @@ -9,8 +10,19 @@ jobs: runs-on: ubuntu-latest steps: + - name: Wait for tests + uses: fountainhead/action-wait-for-check@v1.0.0 + id: wait-for-tests + with: + token: ${{ secrets.GITHUB_TOKEN }} + checkName: All done + ref: ${{ github.ref }} + timeoutSeconds: 3600 + - name: Checkout uses: actions/checkout@v2 + with: + token: ${{ secrets.PERSONAL_TOKEN }} - name: Download new list run: ./update_providers.sh @@ -23,7 +35,7 @@ jobs: - name: Commit changes if: steps.changes.outcome != 'success' run: | - git checkout main -- + git checkout master -- git config user.email "benjamin@opencollective.com" git config user.name "Burnex Bot" git add priv/burner-email-providers/emails.txt @@ -32,13 +44,15 @@ jobs: if: steps.changes.outcome != 'success' run: | CURRENT_VERSION=`cat VERSION` - 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/"` - echo $NEW_TAG > VERSION + NEW_PATCH=`echo $CURRENT_VERSION | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)/\1+1/' | bc` + NEW_VERSION=`echo $CURRENT_VERSION | sed -E "s/(v?[0-9]+\.[0-9]+\.)[0-9]+/\1$NEW_PATCH/"` + echo $NEW_VERSION > VERSION + git add VERSION git commit -m "chore: updated domain list" - git tag -a $NEW_TAG -m $NEW_TAG + git tag -a $NEW_VERSION -m $NEW_VERSION - name: Push changes if: steps.changes.outcome != 'success' run: | - git push --follow-tags \ No newline at end of file + git push + git push --tags \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61722b0..33cc99b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,8 @@ name: Test on: push: + branches: + - '**' pull_request: branches: - master @@ -17,9 +19,10 @@ jobs: - id: skip_check uses: fkirc/skip-duplicate-actions@master with: - concurrent_skipping: always + github_token: ${{ secrets.GITHUB_TOKEN }} + concurrent_skipping: same_content_newer cancel_others: true - skip_after_successful_duplicate: true + skip_after_successful_duplicate: false paths_ignore: '["**/README.md", "**/CHANGELOG.md", "**/LICENSE"]' do_not_skip: '["pull_request"]' @@ -155,3 +158,13 @@ jobs: - name: Run dialyzer run: mix dialyzer + + done: + name: All done + needs: [credo, dialyzer] + runs-on: ubuntu-latest + + steps: + + - name: All done + run: echo Done