Skip to content

kotlin-atlassian-client - default #465

kotlin-atlassian-client - default

kotlin-atlassian-client - default #465

Workflow file for this run

name: kotlin-atlassian-client - default
on:
push:
branches:
- '**'
release:
types: [ created ]
schedule:
- cron: '0 4 * * 2' # At 02:00 on Tuesday
env:
MAIN_BRANCH: 'dev'
MAIN_BRANCH_FULL: 'refs/heads/dev'
MAVEN_OPTS: >
-Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 -Daether.connector.http.connectionMaxTtl=25
jobs:
build:
runs-on: ubuntu-20.04
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Extract and Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION=$(git describe --tags | cut -d v -f2)
echo "Detected version = $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Build libraries
run: mvn package -T 2 -Pci "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
# JIRA
# -------------------------------------------------------
kotlin-jira-client-test-ktor:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION="${{ needs.build.outputs.version }}"
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Startup Jira and Insight
# Loop is needed to prevent Jira from suspension
run: (while true; do sleep 10000; done) | mvn jira:debug -Pitest-jira,-insight-itest-applink,-insight-itest-sdk,-insight-itest-ktor,-jira-itest-applink,-jira-itest-ktor,-jira-itest-sdk "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://localhost:2990" &
- name: Wait for Jira and Insight
run: ./scripts/wait-for-jira.sh
- name: Integration tests using ktor
run: mvn -B verify -Pjira-itest-ktor,jira-ci-ktor,-jira-itest-applink,-jira-itest-sdk,-insight-itest-applink,-insight-itest-sdk,-insight-itest-ktor "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
kotlin-jira-client-test-applink:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION="${{ needs.build.outputs.version }}"
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Startup Jira and Insight
# Loop is needed to prevent Jira from suspension
run: (while true; do sleep 10000; done) | mvn jira:debug -Pitest-jira,-insight-itest-applink,-insight-itest-sdk,-insight-itest-ktor,-jira-itest-applink,-jira-itest-ktor,-jira-itest-sdk "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://localhost:2990" &
- name: Wait for Jira and Insight
run: ./scripts/wait-for-jira.sh
- name: Add hosts to /etc/hosts
run: sudo echo "127.0.0.1 confluence" | sudo tee -a /etc/hosts
- name: Integration tests using applinks
run: mvn -B verify -Pjira-itest-applink,jira-ci-applink,-jira-itest-ktor,-jira-itest-sdk,-insight-itest-applink,-insight-itest-sdk,-insight-itest-ktor "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://confluence:1990"
kotlin-jira-client-test-sdk:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION="${{ needs.build.outputs.version }}"
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Integration tests using sdk
run: mvn clean -B verify -Pjira-itest-sdk,jira-ci-sdk,-jira-itest-applink,-jira-itest-ktor,-insight-itest-sdk,-insight-itest-applink,-insight-itest-ktor "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://localhost:2990"
# INSIGHT
# -------------------------------------------------------
kotlin-insight-client-test-ktor:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION="${{ needs.build.outputs.version }}"
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Startup Jira and Insight
# Loop is needed to prevent Jira from suspension
run: (while true; do sleep 10000; done) | mvn jira:debug -Pitest-jira,-insight-itest-applink,-insight-itest-sdk,-insight-itest-ktor,-jira-itest-applink,-jira-itest-ktor,-jira-itest-sdk "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://localhost:2990" &
- name: Wait for Jira and Insight
run: ./scripts/wait-for-jira.sh
- name: Integration tests using ktor
run: mvn -B verify -Pinsight-itest-ktor,insight-ci-ktor,-jira-itest-applink,-jira-itest-sdk,-jira-itest-ktor,-insight-itest-applink,-insight-itest-sdk "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
kotlin-insight-client-test-sdk:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION="${{ needs.build.outputs.version }}"
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Integration tests using sdk
run: mvn -B verify -Pinsight-itest-sdk,insight-ci-sdk,-insight-itest-ktor,-insight-ci-ktor,-jira-itest-applink,-jira-itest-sdk,-jira-itest-ktor,-insight-itest-applink "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://localhost:2990"
kotlin-insight-client-test-applink:
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Set Release Version
if: ${{ github.event_name == 'release' }}
id: extract-version
run: |
VERSION="${{ needs.build.outputs.version }}"
mvn -B versions:set "-DnewVersion=$VERSION" "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
- name: Startup Jira and Insight
# Loop is needed to prevent Jira from suspension
run: (while true; do sleep 10000; done) | mvn jira:debug -Pitest-jira,-insight-itest-sdk,-insight-itest-ktor,-jira-itest-applink,-insight-itest-applink,-jira-itest-ktor,-jira-itest-sdk "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://localhost:2990" &
- name: Wait for Jira and Insight
run: ./scripts/wait-for-jira.sh
- name: Add hosts to /etc/hosts
run: sudo echo "127.0.0.1 confluence" | sudo tee -a /etc/hosts
- name: Integration tests using applinks
run: mvn -B verify -Pinsight-itest-applink,insight-ci-applink,-insight-itest-ktor,-insight-itest-sdk,-jira-itest-ktor,-jira-itest-sdk,-jira-itest-applink "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}" "-Dbaseurl=http://confluence:1990"
deploy-to-central:
runs-on: ubuntu-20.04
needs: [ build, kotlin-jira-client-test-sdk, kotlin-jira-client-test-ktor, kotlin-jira-client-test-applink, kotlin-insight-client-test-ktor, kotlin-insight-client-test-applink, kotlin-insight-client-test-sdk ]
if: ${{ github.event_name == 'release' }}
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
lfs: true
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Extract, set and commit Release Version
id: extract-version
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
VERSION="${{ needs.build.outputs.version }}"
# Check if the version has already been set in the POM file
CURRENT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
if [ "$CURRENT_VERSION" = "$VERSION" ]; then
echo "Version $VERSION is already set in the POM file."
else
mvn -B versions:set "-DnewVersion=$VERSION" versions:commit "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
fi
# Check if there are changes to commit
if git diff --quiet; then
echo "No changes to commit."
else
git commit -am "[skip ci] set release version $VERSION"
git push origin HEAD:$MAIN_BRANCH
fi
# Check if the tag already exists
TAG_NAME="v$VERSION"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists."
else
git tag -f $TAG_NAME
git push origin -f --tags
fi
- name: gpg version
id: show-gpg-version
run: gpg --version
- name: Install GPG Secret Key
id: install-secret-key
run: cat <(echo -e "${{ secrets.DEV_LINKED_PLANET_PGP_PRIVATE_KEY }}") | gpg --batch --import
- name: List available secret keys
id: list-secret-keys
run: gpg --list-secret-keys --keyid-format LONG
- name: Deploy to Maven Central
run: mvn -B deploy -Pci,-ci-sdk,-ci-jira-applink,-ci-ktor -DskipTests "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
env:
SONATYPE_USERNAME: ${{ vars.SONATYPE_S01_TOKEN_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_S01_TOKEN_PASSWORD }}
SIGNING_PASSWORD: ${{ secrets.DEV_LINKED_PLANET_PGP_KEY_PASSPHRASE }}
prepare-next-snapshot:
runs-on: ubuntu-20.04
needs: [ build, deploy-to-central ]
if: ${{ github.event_name == 'release' }}
steps:
- name: Checkout Source
uses: actions/checkout@v3
- name: Download Maven Cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Prepare next Snapshot Version
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
git fetch origin $MAIN_BRANCH
git reset --hard origin/$MAIN_BRANCH
VERSION="${{ needs.build.outputs.version }}"
MAJOR_VERSION=$(echo "$VERSION" | cut -d . -f1)
MINOR_VERSION=$(echo "$VERSION" | cut -d . -f2)
INCREMENT_VERSION=$(echo "$VERSION" | cut -d . -f3)
NEXT_INCREMENT_VERSION=$((INCREMENT_VERSION + 1))
NEXT_SNAPSHOT_VERSION="$MAJOR_VERSION.$MINOR_VERSION.$NEXT_INCREMENT_VERSION-SNAPSHOT"
mvn -B versions:set "-DnewVersion=$NEXT_SNAPSHOT_VERSION" versions:commit "-Djira.service.management.license=${{ secrets.JSM_DC_DEMO_LICENSE }}" "-Dconfluence.license=${{ secrets.CONFLUENCE_DC_DEMO_LICENSE }}"
git commit -am "[skip ci] set development version $NEXT_SNAPSHOT_VERSION"
git push origin HEAD:$MAIN_BRANCH
notify-slack:
needs: prepare-next-snapshot
if: always()
runs-on: ubuntu-20.04
steps:
- name: Notify Slack
if: ${{ github.ref == env.MAIN_BRANCH_FULL || github.event_name == 'release' }}
uses: iRoachie/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ vars.LP_SLACK_WEBHOOK_URL }}
GITHUB_TOKEN: ${{ secrets.GH_API_TOKEN }}