Make a release and push to nexus #1
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: Make a release and push to nexus | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| type: boolean | |
| description: Make a GitHub release | |
| default: true | |
| publish: | |
| type: boolean | |
| description: Publish to Nexus | |
| default: false | |
| jobs: | |
| package: | |
| name: Build Package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Package the plugin | |
| run: mvn package | |
| - name: Build plugin artifacts zip | |
| run: | | |
| zip --junk-paths plugin-artifacts target/*.jar | |
| - name: Upload plugin artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: plugin-artifacts.zip | |
| path: plugin-artifacts.zip | |
| make_release: | |
| runs-on: ubuntu-latest | |
| needs: package | |
| permissions: write-all | |
| if: ${{ github.event.inputs.release == 'true'}} | |
| steps: | |
| - name: Download code | |
| uses: actions/checkout@v3 | |
| - name: Conventional changelog action | |
| id: changelog | |
| uses: TriPSs/conventional-changelog-action@v5 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| skip-version-file: "true" | |
| skip-on-empty: "false" | |
| skip-tag: "true" | |
| skip-commit: "true" | |
| - name: Fetch release version from build gradle file | |
| run: | | |
| echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
| - name: Download plugin artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: plugin-artifacts.zip | |
| - name: Create release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| if: ${{ steps.changelog.outputs.skipped == 'false' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.RELEASE_VERSION }} | |
| release_name: ${{ env.RELEASE_VERSION }} | |
| body: ${{ steps.changelog.outputs.clean_changelog }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload release asset | |
| id: upload-release-asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./plugin-artifacts.zip | |
| asset_name: plugin-artifacts.zip | |
| asset_content_type: application/zip | |
| publish: | |
| name: Publish to Nexus | |
| needs: package | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.inputs.publish == 'true'}} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| # Setup Maven with OAuth token | |
| - name: Setup Maven with OAuth | |
| id: setup-maven-oauth | |
| uses: curityio/curity-maven-gh-action@v1 | |
| with: | |
| client-secret: ${{ secrets.CURITY_CLI_CLIENT_SECRET }} | |
| - name: Publish package | |
| run: mvn deploy ${{ steps.setup-maven-oauth.outputs.maven-deploy-args }} |