Merge pull request #14 from ClickSend/fix/publish #38
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 Java Package | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Update Gradle wrapper and build config | |
| run: | | |
| sed -i 's|gradle-2.6-bin.zip|gradle-8.6-bin.zip|g' gradle/wrapper/gradle-wrapper.properties | |
| sed -i 's|^ *main = | mainClass = |' build.gradle | |
| sed -i "s|compile '|implementation '|g" build.gradle | |
| sed -i "s|testCompile '|testImplementation '|g" build.gradle | |
| sed -i "s|apply plugin: 'maven'|apply plugin: 'maven-publish'|" build.gradle | |
| sed -i '/install {/,/}/c\ publishing {\n repositories {\n maven {\n url = "https://maven.pkg.github.com/clicksend/clicksend-java"\n credentials {\n username = System.getenv("GPR_USER")\n password = System.getenv("GPR_API_KEY")\n }\n }\n }\n publications {\n maven(MavenPublication) {\n from components.java\n artifactId = "clicksend-java-client"\n }\n }\n }' build.gradle | |
| - name: Publish to Github registry | |
| env: | |
| GPR_USER: ClickSend | |
| GPR_API_KEY: ${{ secrets.GPR_TOKEN }} | |
| run: chmod +x gradlew && ./gradlew publish |