From 8aeb1b153eb3d5cf51249781fe428282b92a2201 Mon Sep 17 00:00:00 2001 From: Raphael Vullriede Date: Tue, 30 Jul 2024 10:06:24 +0200 Subject: [PATCH] update and align CI/CD --- .github/workflows/build-on-push.yml | 21 +++++++++++++++ .github/workflows/dependabot-auto-approve.yml | 27 +++++++++++++++++++ .github/workflows/maven.yml | 23 ---------------- ...ish-release.yml => publish-on-release.yml} | 13 +++++---- README.md | 2 +- 5 files changed, 57 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/build-on-push.yml create mode 100644 .github/workflows/dependabot-auto-approve.yml delete mode 100644 .github/workflows/maven.yml rename .github/workflows/{maven-publish-release.yml => publish-on-release.yml} (78%) diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml new file mode 100644 index 0000000..621e2b9 --- /dev/null +++ b/.github/workflows/build-on-push.yml @@ -0,0 +1,21 @@ +name: build-on-push + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: setup-jdk + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + cache: maven + - name: maven-build + run: mvn --batch-mode --update-snapshots package \ No newline at end of file diff --git a/.github/workflows/dependabot-auto-approve.yml b/.github/workflows/dependabot-auto-approve.yml new file mode 100644 index 0000000..6351439 --- /dev/null +++ b/.github/workflows/dependabot-auto-approve.yml @@ -0,0 +1,27 @@ +name: dependabot-pr-auto-merge +on: pull_request + +jobs: + dependabot: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + repository-projects: write + if: github.actor == 'dependabot[bot]' + steps: + - name: dependabot-pr-fetch-metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: dependabot-pr-approve + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: dependabot-pr-auto-merge + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index 34f4391..0000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,23 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Java CI with Maven - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'temurin' - cache: maven - - name: Build with Maven - run: mvn --batch-mode --update-snapshots package \ No newline at end of file diff --git a/.github/workflows/maven-publish-release.yml b/.github/workflows/publish-on-release.yml similarity index 78% rename from .github/workflows/maven-publish-release.yml rename to .github/workflows/publish-on-release.yml index c9fe461..21f6ced 100644 --- a/.github/workflows/maven-publish-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -1,4 +1,4 @@ -name: Publish release package to the Maven Central Repository +name: publish-on-release on: release: types: [ created ] @@ -6,6 +6,9 @@ on: jobs: publish: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Install gpg secret key run: | @@ -13,9 +16,9 @@ jobs: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import # Verify gpg secret key gpg --list-secret-keys --keyid-format LONG - - uses: actions/checkout@v3 - - name: Set up JDK - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - name: setup-jdk + uses: actions/setup-java@v4 with: java-version: 17 distribution: 'temurin' @@ -23,7 +26,7 @@ jobs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD - - name: Publish package + - name: publish-on-maven-central run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -P osslabz-release clean deploy env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} diff --git a/README.md b/README.md index 90ffc31..627c966 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ EVM ABI Decoder =============== ![GitHub](https://img.shields.io/github/license/osslabz/evm-abi-decoder) -![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/evm-abi-decoder/maven.yml?branch=main) +![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/evm-abi-decoder/build-on-push.yml?branch=main) [![Maven Central](https://img.shields.io/maven-central/v/net.osslabz/evm-abi-decoder?label=Maven%20Central)](https://search.maven.org/artifact/net.osslabz/evm-abi-decoder) EVM ABI Decoder allows to decode raw input data from a EVM transaction (on Ethereum or a compatible chain like Avalanche, BSC etc.)