From a9fb538dfd85cd4c78e6580388ce934162d0fc5a Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 17 Feb 2022 14:09:07 -0800 Subject: [PATCH 1/4] feat: add GH action to update dependencies --- .github/workflows/update-dependencies.yml | 68 +++++++++++++++++++++++ Makefile | 5 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update-dependencies.yml diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 0000000..2f9e70d --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,68 @@ +name: Update dependencies +on: + schedule: + # Run automatically at 7AM PST Tuesday + - cron: '0 14 * * 2' + workflow_dispatch: + +jobs: + update-dependencies-and-test: + name: Update Dependencies & Test + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + java: [ 8, 11, 17 ] + + steps: + - name: Checkout smtpapi-java + uses: actions/checkout@v2 + + - name: Updating semver dependencies + run: make update-deps + + - name: Set up Java + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ matrix.java }} + cache: 'maven' + + - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V + + commit-dependencies: + name: Commit Updated Dependencies + if: success() + needs: [ update-dependencies-and-test ] + runs-on: ubuntu-latest + steps: + - name: Checkout smtpapi-java + uses: actions/checkout@v2 + + - name: Updating semver dependencies + run: make update-deps + + - name: Add & Commit + uses: EndBug/add-and-commit@v8.0.2 + with: + add: 'pom.xml' + default_author: 'github_actions' + message: 'chore: update smtpapi-java dependencies' + + notify-on-failure: + name: Slack notify on failure + if: failure() + needs: [ update-dependencies-and-test, commit-dependencies ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: failure + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, commit dependencies *{1}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, needs.commit-dependencies.result, github.server_url, github.repository, github.run_id) }} + SLACK_TITLE: Action Failure - ${{ github.repository }} + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/Makefile b/Makefile index 4c4a94e..4dec826 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install package test clean +.PHONY: install package test update-deps clean VERSION := $(shell mvn help:evaluate -Dexpression=project.version --batch-mode | grep -e '^[^\[]') install: @@ -13,5 +13,8 @@ package: test: mvn test +update-deps: + mvn versions:use-latest-releases versions:commit -DallowMajorUpdates=false + clean: mvn clean From ccd0611d27a741dfa982062de4862bdd78c4fc0d Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Wed, 23 Feb 2022 18:25:52 -0800 Subject: [PATCH 2/4] combine into 1 job --- .github/workflows/update-dependencies.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index 2f9e70d..a060cbf 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 strategy: + max-parallel: 1 matrix: java: [ 8, 11, 17 ] @@ -30,19 +31,8 @@ jobs: - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V - commit-dependencies: - name: Commit Updated Dependencies - if: success() - needs: [ update-dependencies-and-test ] - runs-on: ubuntu-latest - steps: - - name: Checkout smtpapi-java - uses: actions/checkout@v2 - - - name: Updating semver dependencies - run: make update-deps - - name: Add & Commit + if: matrix.java == '17' uses: EndBug/add-and-commit@v8.0.2 with: add: 'pom.xml' @@ -52,14 +42,14 @@ jobs: notify-on-failure: name: Slack notify on failure if: failure() - needs: [ update-dependencies-and-test, commit-dependencies ] + needs: [ update-dependencies-and-test ] runs-on: ubuntu-latest steps: - uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: failure SLACK_ICON_EMOJI: ':github:' - SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, commit dependencies *{1}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, needs.commit-dependencies.result, github.server_url, github.repository, github.run_id) }} + SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }} SLACK_TITLE: Action Failure - ${{ github.repository }} SLACK_USERNAME: GitHub Actions SLACK_MSG_AUTHOR: twilio-dx From fc370bf5d77288026b4a5bbe82309cef0bd45049 Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 24 Feb 2022 10:37:46 -0800 Subject: [PATCH 3/4] fix slack message indices --- .github/workflows/update-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index a060cbf..f716ecc 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -49,7 +49,7 @@ jobs: env: SLACK_COLOR: failure SLACK_ICON_EMOJI: ':github:' - SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {2}/{3}/actions/runs/{4}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }} + SLACK_MESSAGE: ${{ format('Update dependencies *{0}*, {1}/{2}/actions/runs/{3}', needs.update-dependencies-and-test.result, github.server_url, github.repository, github.run_id) }} SLACK_TITLE: Action Failure - ${{ github.repository }} SLACK_USERNAME: GitHub Actions SLACK_MSG_AUTHOR: twilio-dx From 1a7dc05d541a09197ba4c6721d23a54b0ea657a4 Mon Sep 17 00:00:00 2001 From: Jennifer Mah Date: Thu, 24 Feb 2022 11:33:39 -0800 Subject: [PATCH 4/4] move updating deps after java is setup --- .github/workflows/update-dependencies.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index f716ecc..1257687 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -19,9 +19,6 @@ jobs: - name: Checkout smtpapi-java uses: actions/checkout@v2 - - name: Updating semver dependencies - run: make update-deps - - name: Set up Java uses: actions/setup-java@v2 with: @@ -29,6 +26,9 @@ jobs: java-version: ${{ matrix.java }} cache: 'maven' + - name: Updating semver dependencies + run: make update-deps + - run: mvn install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V - name: Add & Commit