Skip to content

Release Creation

Release Creation #23

Workflow file for this run

name: Release Creation
on:
workflow_call:
inputs:
tag:
description: 'Next release tag'
required: true
type: string
rchannels:
description: 'Channels to publish development releases'
required: false
type: string
workflow_dispatch:
inputs:
tag:
description: 'Next release tag'
required: true
type: string
rchannels:
description: 'Channels to publish development releases'
required: false
type: string
jobs:
deleteDevReleases:
uses: Checkmarx/ast-teamcity-plugin/.github/workflows/delete-dev-releases.yml@main
with:
tag: ${{ inputs.rchannels }}
secrets: inherit
if: inputs.rchannels
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
# Set the tag in an env var
- name: Set env
run: |
echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV
- name: Create Release Name
run: |
echo "Creating release name"
if [ -z "${{ inputs.rchannels }}" ]; then
echo "GH_RELEASE_TAG_NAME=${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
else
echo "GH_RELEASE_TAG_NAME=${{ env.RELEASE_VERSION }}-${{ inputs.rchannels }}" >> $GITHUB_ENV
fi
echo "Release name - ${{ env.GH_RELEASE_TAG_NAME }}"
- name: Cache local Maven repository
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
settings-path: ${{ github.workspace }}
- name: Update the POM version.
run: mvn -B versions:set -DnewVersion='${{ env.RELEASE_VERSION }}' --file pom.xml -s $GITHUB_WORKSPACE/settings.xml -DskipTests
env:
GITHUB_TOKEN: ${{ github.token}}
- name: Build with Maven
run: mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml -DskipTests
env:
GITHUB_TOKEN: ${{ github.token }}
# Create the release
- name: Create Release or Pre-release
uses: softprops/action-gh-release@master
with:
release_name: Checkmarx Azure ${{ env.RELEASE_VERSION }}
tag_name: ${{ env.GH_RELEASE_TAG_NAME }}
files: ./build/target/checkmarx-ast-teamcity-plugin.zip
generate_release_notes: true
prerelease: ${{ inputs.rchannels != '' && inputs.rchannels != null }}
- name: Release to marketplace
run: |
if [ -z "${{ inputs.rchannels }}" ]; then
curl -i --header "Authorization: Bearer ${{ secrets.JETBRAINS_USER }}" -F pluginId=${{ secrets.JETBRAINS_PLUGIN_ID }} -F file=@./build/target/checkmarx-ast-teamcity-plugin.zip https://plugins.jetbrains.com/plugin/uploadPlugin
else
curl -i --header "Authorization: Bearer ${{ secrets.JETBRAINS_USER }}" -F channel=${{ inputs.rchannels }} -F pluginId=${{ secrets.JETBRAINS_PLUGIN_ID }} -F file=@./build/target/checkmarx-ast-teamcity-plugin.zip https://plugins.jetbrains.com/plugin/uploadPlugin
fi
- name: Get latest release notes
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
body_release="$(gh api -H "Accept: application/vnd.github.v3+json" /repos/Checkmarx/ast-teamcity-plugin/releases/latest | jq -r '.body' )"
body_release="${body_release//$'\n'/'%0A'}"
echo "::set-output name=body_release::$body_release"
- name: Converts Markdown to HTML
id: convert
uses: lifepal/[email protected]
with:
text: "${{ steps.release.outputs.body_release }}"
- name: Clean html
id: clean
run: |
clean="$(echo "${{ steps.convert.outputs.html }}" | awk '{gsub(/id=.[a-z]+/,"");print}' | tr -d '\n')"
echo "$clean"
echo "::set-output name=clean::$clean"
- name: Send a Notification
id: notify
uses: thechetantalwar/teams-notify@v2
with:
teams_webhook_url: ${{ secrets.TEAMS_WEBHOOK_URI }}
message: "<h1>Checkmarx TeamCity Plugin ${{ env.RELEASE_VERSION }}</h1>${{ steps.clean.outputs.clean }}"
if: ${{ inputs.rchannels == '' || inputs.rchannels == null }}