diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..8f70f0a --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,50 @@ +name: Release & Deploy New Version to Maven Central +on: + push: + tags: + - '*' + +jobs: + publish: + permissions: write-all + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Java for publishing to Maven Central Repository + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Create Properties File + run: | + echo " + test-secret=secret + " >> src/test/resources/secret.properties + - name: Start Unit Test DB + run: | + docker compose up --build -d + - name: Build, Test & Publish + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "${{ github.workspace }}/out/artifacts/wasapi_jar/*.jar" + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish to the Maven Central Repository + run: | + mvn \ + --no-transfer-progress \ + --batch-mode \ + deploy + - name: Docker Compose Down # check if it's in the right place + if: always() + run: docker compose down -v + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_SECRET_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ No newline at end of file