migration to new central publishing: fix server variables for github … #565
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: 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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- 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 | |
./mvnw -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: ./mvnw 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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Set Release Version | |
if: ${{ github.event_name == 'release' }} | |
id: extract-version | |
run: | | |
VERSION="${{ needs.build.outputs.version }}" | |
./mvnw -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) | ./mvnw 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: ./mvnw -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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Set Release Version | |
if: ${{ github.event_name == 'release' }} | |
id: extract-version | |
run: | | |
VERSION="${{ needs.build.outputs.version }}" | |
./mvnw -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: | | |
echo "MAVEN VERSION" | |
./mvnw -version | |
echo "JAVA_HOME" | |
java -version | |
(while true; do sleep 10000; done) | ./mvnw 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" > jira-startup.log & | |
echo "JIRA_PID=$!" >> $GITHUB_ENV | |
- 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: ./mvnw -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" | |
- name: Stop jira to write coverage data | |
run: | | |
echo "Stopping process with PID $JIRA_PID" | |
./scripts/shutdown-jira.sh $JIRA_PID | |
- name: Store jira startup log | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: jira-startup.log | |
path: jira-startup.log | |
if-no-files-found: 'warn' | |
retention-days: 3 | |
- name: Store jira logs | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: atlassian-jira.log | |
path: target/jira/home/log/atlassian-jira.log | |
if-no-files-found: 'warn' | |
retention-days: 3 | |
kotlin-jira-client-test-sdk: | |
runs-on: ubuntu-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Set Release Version | |
if: ${{ github.event_name == 'release' }} | |
id: extract-version | |
run: | | |
VERSION="${{ needs.build.outputs.version }}" | |
./mvnw -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: ./mvnw 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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Set Release Version | |
if: ${{ github.event_name == 'release' }} | |
id: extract-version | |
run: | | |
VERSION="${{ needs.build.outputs.version }}" | |
./mvnw -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) | ./mvnw 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: ./mvnw -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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Set Release Version | |
if: ${{ github.event_name == 'release' }} | |
id: extract-version | |
run: | | |
VERSION="${{ needs.build.outputs.version }}" | |
./mvnw -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: ./mvnw -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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Set Release Version | |
if: ${{ github.event_name == 'release' }} | |
id: extract-version | |
run: | | |
VERSION="${{ needs.build.outputs.version }}" | |
./mvnw -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) | ./mvnw 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: ./mvnw -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-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Extract, set and commit Release Version | |
id: extract-version | |
run: | | |
git config user.email "actions@github.com" | |
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=$(./mvnw -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 | |
./mvnw -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: ./mvnw -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_CENTRAL_TOKEN_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_TOKEN_PASSWORD }} | |
SIGNING_PASSWORD: ${{ secrets.DEV_LINKED_PLANET_PGP_KEY_PASSPHRASE }} | |
prepare-next-snapshot: | |
runs-on: ubuntu-24.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 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Prepare next Snapshot Version | |
run: | | |
git config user.email "actions@github.com" | |
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" | |
./mvnw -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-24.04 | |
steps: | |
- name: Notify Slack | |
if: ${{ github.ref == env.MAIN_BRANCH_FULL || github.event_name == 'release' }} | |
uses: iRoachie/slack-github-actions@v2.3.2 | |
env: | |
SLACK_WEBHOOK_URL: ${{ vars.LP_SLACK_WEBHOOK_URL }} | |
GITHUB_TOKEN: ${{ secrets.GH_API_TOKEN }} |