|
| 1 | +name: Make a release and push to nexus |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + release: |
| 6 | + type: boolean |
| 7 | + description: Make a GitHub release |
| 8 | + default: true |
| 9 | + publish: |
| 10 | + type: boolean |
| 11 | + description: Publish to Nexus |
| 12 | + default: false |
| 13 | + |
| 14 | +jobs: |
| 15 | + package: |
| 16 | + name: Build Package |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Set up JDK 21 |
| 24 | + uses: actions/setup-java@v4 |
| 25 | + with: |
| 26 | + java-version: '21' |
| 27 | + distribution: 'temurin' |
| 28 | + cache: 'maven' |
| 29 | + |
| 30 | + - name: Package the plugin |
| 31 | + run: mvn package |
| 32 | + |
| 33 | + - name: Build plugin artifacts zip |
| 34 | + run: | |
| 35 | + zip --junk-paths plugin-artifacts target/*.jar |
| 36 | +
|
| 37 | + - name: Upload plugin artifacts |
| 38 | + uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: plugin-artifacts.zip |
| 41 | + path: plugin-artifacts.zip |
| 42 | + |
| 43 | + make_release: |
| 44 | + runs-on: ubuntu-latest |
| 45 | + needs: package |
| 46 | + permissions: write-all |
| 47 | + if: ${{ github.event.inputs.release == 'true'}} |
| 48 | + steps: |
| 49 | + - name: Download code |
| 50 | + uses: actions/checkout@v3 |
| 51 | + |
| 52 | + - name: Conventional changelog action |
| 53 | + id: changelog |
| 54 | + uses: TriPSs/conventional-changelog-action@v5 |
| 55 | + with: |
| 56 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + skip-version-file: "true" |
| 58 | + skip-on-empty: "false" |
| 59 | + skip-tag: "true" |
| 60 | + skip-commit: "true" |
| 61 | + |
| 62 | + - name: Fetch release version from build gradle file |
| 63 | + run: | |
| 64 | + echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV |
| 65 | +
|
| 66 | + - name: Download plugin artifacts |
| 67 | + uses: actions/download-artifact@v4 |
| 68 | + with: |
| 69 | + name: plugin-artifacts.zip |
| 70 | + |
| 71 | + - name: Create release |
| 72 | + id: create_release |
| 73 | + uses: actions/create-release@v1 |
| 74 | + if: ${{ steps.changelog.outputs.skipped == 'false' }} |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + with: |
| 78 | + tag_name: ${{ env.RELEASE_VERSION }} |
| 79 | + release_name: ${{ env.RELEASE_VERSION }} |
| 80 | + body: ${{ steps.changelog.outputs.clean_changelog }} |
| 81 | + draft: false |
| 82 | + prerelease: false |
| 83 | + |
| 84 | + - name: Upload release asset |
| 85 | + id: upload-release-asset |
| 86 | + uses: actions/upload-release-asset@v1 |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + with: |
| 90 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 91 | + asset_path: ./plugin-artifacts.zip |
| 92 | + asset_name: plugin-artifacts.zip |
| 93 | + asset_content_type: application/zip |
| 94 | + |
| 95 | + |
| 96 | + publish: |
| 97 | + name: Publish to Nexus |
| 98 | + needs: package |
| 99 | + runs-on: ubuntu-latest |
| 100 | + if: ${{ github.event.inputs.publish == 'true'}} |
| 101 | + steps: |
| 102 | + - name: Checkout code |
| 103 | + uses: actions/checkout@v4 |
| 104 | + |
| 105 | + - name: Set up JDK 21 |
| 106 | + uses: actions/setup-java@v4 |
| 107 | + with: |
| 108 | + java-version: '21' |
| 109 | + distribution: 'temurin' |
| 110 | + cache: 'maven' |
| 111 | + |
| 112 | + # Setup Maven with OAuth token |
| 113 | + - name: Setup Maven with OAuth |
| 114 | + id: setup-maven-oauth |
| 115 | + uses: curityio/curity-maven-gh-action@v1 |
| 116 | + with: |
| 117 | + client-secret: ${{ secrets.CURITY_CLI_CLIENT_SECRET }} |
| 118 | + |
| 119 | + - name: Publish package |
| 120 | + run: mvn deploy ${{ steps.setup-maven-oauth.outputs.maven-deploy-args }} |
0 commit comments