chore: update publish workflow to include snapshot input and PR creation #19
Workflow file for this run
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
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| snapshot: | ||
| type: checkbox | ||
| description: "Is a snapshot release?" | ||
| required: true | ||
| default: true | ||
| jobs: | ||
| generate-and-publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
| - name: Set Up JDK | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: 'corretto' | ||
| java-version: '21' | ||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
| with: | ||
| gradle-version: "8.13" | ||
| - name: Install Post Processor | ||
| working-directory: generator/src/main/resources/post-processor | ||
| run: npm ci && npm run clean && npm run compile | ||
| - name: Build Project | ||
| run: gradle build | ||
| - name: Generate SDK | ||
| working-directory: generator | ||
| run: | | ||
| export KOTLIN_POST_PROCESS_FILE="npm run --prefix src/main/resources/post-processor process" | ||
| gradle openApiGenerate | ||
| - name: Open PR | ||
| uses: peter-evans/create-pull-request@v7 | ||
| working-directory: xap-sdk | ||
| with: | ||
| token: ${{ secrets.GITHUB_PAT }} | ||
| commit-message: "chore: publishing code for sdk release $(date +'%Y%m%d%H%M%S')" | ||
| title: "chore: code update on $(date +'%Y%m%d%H%M%S')" | ||
| branch: "xap-sdk-code-update-$(date +'%Y%m%d%H%M%S')" | ||
| add-paths: . | ||
| - name: Publish SDK | ||
| working-directory: xap-sdk | ||
| env: | ||
| GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }} | ||
| GPG_SECRET: ${{ secrets.GPG_PRIVATE_KEY }} | ||
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
| run: | | ||
| if [ -z "${{ github.event.inputs.snapshot }}" ]; then | ||
| gradle publishToSonatype closeAndReleaseSonatypeStagingRepository | ||
| else | ||
| exit 1 | ||
| # ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | ||
| fi | ||