chore: update publish workflow to include snapshot input and PR creation #18
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 | ||
| with: | ||
| token: ${{ secrets.GITHUB_PAT }} | ||
| commit-message: "chore: publishing docs for version ${{ env.NEW_DOCS_VERSION }}" | ||
| body: "This PR adds the reference documentation for version ${{ env.NEW_DOCS_VERSION }}." | ||
| title: "chore: reference docs update for version ${{ env.NEW_DOCS_VERSION }}" | ||
| branch: "docs-update-${{ env.NEW_DOCS_VERSION }}-$(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 | ||