Release New Official Plugin Version #1664
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: Release New Official Plugin Version | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| check_run: | |
| types: | |
| - completed | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_release: ${{ steps.interesting-categories.outputs.interesting == 'true' }} | |
| steps: | |
| - name: Verify CI status | |
| uses: jenkins-infra/verify-ci-status-action@7d194d0c5785a12623f350581db5243063542f90 #v1.2.2 | |
| id: verify-ci-status | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| output_result: true | |
| - name: Release Drafter | |
| uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 #v6 | |
| if: steps.verify-ci-status.outputs.result == 'success' | |
| with: | |
| name: next | |
| tag: next | |
| version: next | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check interesting categories | |
| uses: jenkins-infra/interesting-category-action@78f4b74509528c18790d9c36b2cccb5b21ed3451 #v1.2.1 | |
| if: steps.verify-ci-status.outputs.result == 'success' | |
| id: interesting-categories | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: needs.validate.outputs.should_release == 'true' | |
| outputs: | |
| TAG_NAME: ${{ steps.get_new_tag.outputs.TAG_NAME }} | |
| CLI_VERSION: ${{ steps.set_outputs.outputs.CLI_VERSION }} | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 11 | |
| uses: actions/[email protected] | |
| with: | |
| distribution: temurin | |
| java-version: 11 | |
| - name: Release | |
| uses: jenkins-infra/jenkins-maven-cd-action@5f5529707ac2bef1ff86da2553ce465ed669aa65 #v1.3.3 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} | |
| - name: Ensure Maven Dependencies are Downloaded | |
| run: mvn dependency:resolve | |
| - name: Get the new tag | |
| id: get_new_tag | |
| run: | | |
| git fetch --tag | |
| TAG_NAME=$(git describe --tags --abbrev=0) | |
| echo "Extracted Tag Name: $TAG_NAME" | |
| echo "TAG_NAME=$TAG_NAME" | tee -a $GITHUB_ENV $GITHUB_OUTPUT | |
| - name: Extract CLI version | |
| id: extract_cli_version | |
| run: | | |
| chmod +x .github/scripts/extract_cli_version.sh | |
| .github/scripts/extract_cli_version.sh cx-linux | |
| - name: Print Extracted CLI Version | |
| run: | | |
| echo "Extracted CLI Version: ${{ env.CLI_VERSION }}" | |
| - name: Echo CLI version and tag name to outputs | |
| id: set_outputs | |
| run: | | |
| echo "::set-output name=CLI_VERSION::${{ env.CLI_VERSION }}" | |
| - name: Get GitHub Release Upload URL | |
| id: get-release | |
| run: | | |
| UPLOAD_URL=$(gh api /repos/${{ github.repository }}/releases/tags/${{ env.TAG_NAME }} --jq '.upload_url') | |
| if [[ -z "$UPLOAD_URL" ]]; then | |
| echo "❌ ERROR: Failed to retrieve upload URL" | |
| exit 1 | |
| fi | |
| echo "UPLOAD_URL=$UPLOAD_URL" | tee -a $GITHUB_ENV $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Release Asset | |
| id: upload-release-asset | |
| uses: shogo82148/actions-upload-release-asset@8f032eff0255912cc9c8455797fd6d72f25c7ab7 #v1 | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| with: | |
| github_token: ${{ github.token }} | |
| upload_url: ${{ env.UPLOAD_URL }} | |
| asset_path: ./target/checkmarx-ast-scanner.hpi | |
| asset_name: checkmarx-ast-scanner.hpi | |
| asset_content_type: application/multipart-core | |
| overwrite: true | |
| notify: | |
| needs: release | |
| uses: ./.github/workflows/release-notify.yml | |
| with: | |
| product_name: Jenkins | |
| release_version: ${{ needs.release.outputs.TAG_NAME }} | |
| cli_release_version: ${{ needs.release.outputs.CLI_VERSION }} | |
| release_author: "Sypher Team" | |
| release_url: https://github.com/jenkinsci/checkmarx-ast-scanner-plugin/releases/tag/${{ needs.release.outputs.TAG_NAME }} | |
| jira_product_name: JENKINS | |
| secrets: inherit |