diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..de5a7dd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build and Test + +on: + push: + branches: + - 'main' + + pull_request: + branches: + - 'main' + - 'feature/**' + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + env: + apiKey: ${{ secrets.API_KEY }} + secretKey: ${{secrets.SECRET_KEY}} + contractCode: ${{secrets.CONTRACT_CODE}} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Java 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '11' + cache: maven + + - name: Build and test + run: mvn --batch-mode clean verify \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..bf7ed69 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +name: Publish to Maven Central + +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '11' + cache: maven + + server-id: central + server-username: CENTRAL_USERNAME + server-password: CENTRAL_PASSWORD + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Publish + run: mvn --batch-mode clean deploy -DskipTests + env: + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} + GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + diff --git a/pom.xml b/pom.xml index 5b3593d..33616ae 100644 --- a/pom.xml +++ b/pom.xml @@ -101,22 +101,6 @@ - - - org.apache.maven.plugins - maven-gpg-plugin - 3.1.0 - - - sign-artifacts - verify - - sign - - - - - org.sonatype.central central-publishing-maven-plugin @@ -175,6 +159,26 @@ ${maven.compiler.target} + + org.apache.maven.plugins + maven-gpg-plugin + 3.1.0 + + + ${gpg.keyname} + ${gpg.passphrase} + + + + + sign-artifacts + verify + + sign + + + +