Release Creation #76
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 Creation | |
| on: | |
| workflow_call: | |
| inputs: | |
| tag: | |
| description: 'Next release tag' | |
| required: true | |
| type: string | |
| rbranch: | |
| description: 'Branch to publish development releases' | |
| required: false | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Next release tag' | |
| required: true | |
| type: string | |
| rbranch: | |
| description: 'Branch to publish development releases' | |
| required: false | |
| type: string | |
| jobs: | |
| deleteDevReleases: | |
| uses: Checkmarx/ast-eclipse-plugin/.github/workflows/delete-dev-releases.yml@main | |
| with: | |
| tag: ${{ inputs.rbranch }} | |
| secrets: inherit | |
| if: inputs.rbranch | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| TAG_NAME: ${{ steps.generate_tag_name.outputs.TAG_NAME }} | |
| CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3.5.2 | |
| with: | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| - name: Create Release Name | |
| id: generate_tag_name | |
| run: | | |
| echo "Creating release name" | |
| if [ -z "${{ inputs.rbranch }}" ]; then | |
| export GH_RELEASE_TAG_NAME="${{ inputs.tag }}" | |
| export GH_BRANCH_NAME="main" | |
| else | |
| export GH_RELEASE_TAG_NAME="${{ inputs.tag }}-${{ inputs.rbranch }}" | |
| export GH_BRANCH_NAME="nightly" | |
| fi | |
| echo "Generated TAG_NAME: $GH_RELEASE_TAG_NAME" | |
| # Persist the variables | |
| echo "GH_RELEASE_TAG_NAME=$GH_RELEASE_TAG_NAME" >> $GITHUB_ENV | |
| echo "GH_BRANCH_NAME=$GH_BRANCH_NAME" >> $GITHUB_ENV | |
| # Set outputs for future steps | |
| echo "TAG_NAME=$GH_RELEASE_TAG_NAME" >> $GITHUB_OUTPUT | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: temurin | |
| java-version: 8 | |
| - name: Cache local Maven repository | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Update the POM version. | |
| run: mvn -B org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion='${{ inputs.tag }}' --file pom.xml | |
| - name: Create release | |
| run: mvn -B clean install --file pom.xml -DskipTests -pl "!checkmarx-ast-eclipse-plugin-tests" | |
| - name: Extract CLI version | |
| id: extract_cli_version | |
| run: | | |
| chmod +x ./.github/scripts/extract_cli_version.sh | |
| CLI_VERSION=$(./.github/scripts/extract_cli_version.sh cx-linux | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+') | |
| # Debugging output | |
| echo "CLI Version Extracted: $CLI_VERSION" | |
| # Make CLI_VERSION available for later steps | |
| echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV | |
| echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_OUTPUT | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.GH_RELEASE_TAG_NAME }} | |
| generate_release_notes: true | |
| files: ./com.checkmarx.eclipse.site/target/com.checkmarx.eclipse.site-*.zip | |
| prerelease: ${{ inputs.rbranch != '' && inputs.rbranch != null }} | |
| - name: Git configuration | |
| run: | | |
| git config --global safe.directory "/tmp/**/*/" | |
| git config --global http.postBuffer 2097152000 | |
| git config --global https.postBuffer 2097152000 | |
| - name: Create update site | |
| uses: cpina/github-action-push-to-another-repository@main | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| with: | |
| source-directory: './com.checkmarx.eclipse.site/target/repository/' | |
| destination-github-username: 'cylon-bot' | |
| destination-repository-username: 'CheckmarxDev' | |
| destination-repository-name: 'ast-eclipse-plugin-update-site' | |
| user-email: cylon-bot@checkmarx.com | |
| target-branch: ${{ env.GH_BRANCH_NAME }} | |
| notify: | |
| if: ${{ inputs.rbranch == 'daniel-test' || inputs.rbranch == null }} | |
| needs: release | |
| uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main | |
| with: | |
| product_name: Eclipse | |
| release_version: ${{ needs.release.outputs.TAG_NAME }} | |
| cli_release_version: ${{ needs.release.outputs.CLI_VERSION }} | |
| release_author: "Phoenix Team" | |
| release_url: https://github.com/Checkmarx/ast-eclipse-plugin/releases/tag/${{ needs.release.outputs.TAG_NAME }} | |
| jira_product_name: ECLIPSE | |
| secrets: inherit |