Drop setup() everywhere; db is explicit on insert/update/delete #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Maven Central | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "11" | |
| distribution: "temurin" | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Read local version | |
| id: local | |
| run: | | |
| V=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
| echo "version=$V" >> "$GITHUB_OUTPUT" | |
| - name: Check if version already on Maven Central | |
| id: gate | |
| run: | | |
| set +e | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | |
| "https://repo1.maven.org/maven2/org/onql/onql-client/${{ steps.local.outputs.version }}/onql-client-${{ steps.local.outputs.version }}.pom") | |
| if [ "$STATUS" = "200" ]; then | |
| echo "already=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "already=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Deploy to Maven Central | |
| if: steps.gate.outputs.already == 'false' | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| run: mvn --batch-mode clean deploy |