chore: improved release yml #28
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: Parsek Mail Plugin Release | |
| on: | |
| push: | |
| branches: [ "dev", "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| get-next-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: "lts/*" | |
| - name: Dry run to get next release version | |
| id: get-next-version | |
| run: | | |
| export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'next release version is ' | awk -F"next release version is " '{print $2}') | |
| echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| outputs: | |
| new_tag_version: ${{ steps.get-next-version.outputs.new_tag_version }} | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: get-next-version | |
| if: ${{ needs.get-next-version.outputs.new_tag_version != '' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build with Gradle | |
| run: | | |
| ./gradlew build -Pversion=${{ needs.get-next-version.outputs.new_tag_version }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: build/libs/ | |
| gh-release: | |
| name: GH Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ needs.get-next-version.outputs.new_tag_version != '' }} | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "lts/*" | |
| - name: Install deps for semantic-release | |
| run: | | |
| npm ci | |
| # Eğer package.json yoksa bu adımı kaldırabilirsiniz | |
| - name: Create GitHub Release with semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| run: npx semantic-release | |
| maven-central-deploy: | |
| name: Maven Central Deploy | |
| runs-on: ubuntu-latest | |
| needs: [ get-next-version, build, gh-release ] | |
| if: ${{ needs.get-next-version.outputs.new_tag_version != '' }} | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: build/libs/ | |
| - name: Verify downloaded artifacts | |
| run: ls -R build/libs | |
| - name: Deploy to Maven Central with JReleaser | |
| id: jreleaser | |
| run: | | |
| ./gradlew -Pversion=${{ needs.get-next-version.outputs.new_tag_version }} jreleaserDeploy | |
| env: | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }} | |
| JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.MAVENCENTRAL_TOKEN }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | |
| - name: Upload JReleaser logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jreleaser-logs | |
| path: | | |
| build/jreleaser/trace.log | |
| build/jreleaser/output.properties |