forked from TBD54566975/tbdex-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue TBD54566975#94: Deploy SNAPSHOT to TBD Artifactory as part of b…
…uild
- Loading branch information
1 parent
7182302
commit b0f49a0
Showing
1 changed file
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,11 @@ name: CI Issue 94 | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version of Kotlin binary to publish to TBD Artifactory. For example "1.0.0-SNAPSHOT". If not supplied, will default to version specified in the POM. Must end in "-SNAPSHOT".' | ||
required: false | ||
default: "0.0.0-SNAPSHOT" | ||
push: | ||
branches: | ||
- main | ||
|
@@ -89,7 +94,7 @@ jobs: | |
- name: Lint | ||
run: just lint | ||
|
||
kt-test: | ||
kotlin-build-test-deploy-snapshot: | ||
needs: | ||
- build_aarch64_apple_darwin | ||
- build_x86_64_apple_darwin | ||
|
@@ -105,6 +110,30 @@ jobs: | |
with: | ||
distribution: "adopt" | ||
java-version: "11" | ||
|
||
- name: Resolve Snapshot Version | ||
id: resolve_version | ||
run: | | ||
# Version resolution: use provided | ||
if [ -n "${{ github.event.inputs.version }}" ]; then | ||
resolvedVersion=${{ github.event.inputs.version }} | ||
# Otherwise, construct a version for deployment in form X.Y.Z-commit-$shortSHA-SNAPSHOT | ||
else | ||
longSHA=$(git rev-parse --verify HEAD) | ||
shortSHA=$(echo "${longSHA:0:7}") | ||
resolvedVersion="commit-$shortSHA-SNAPSHOT" | ||
echo "Requesting deployment as version: $resolvedVersion" | ||
fi | ||
# Postcondition check; only allow this to proceed if we have a version ending in "-SNAPSHOT" | ||
if [[ ! "$resolvedVersion" =~ -SNAPSHOT$ ]]; then | ||
echo "Error: The version does not end with \"-SNAPSHOT\": $resolvedVersion" | ||
exit 1 | ||
fi | ||
echo "Resolved SNAPSHOT Version: $resolvedVersion" | ||
echo "resolved_version=$resolvedVersion" >> $GITHUB_OUTPUT | ||
- name: Download MacOS aarch64 Native Library | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -125,13 +154,34 @@ jobs: | |
with: | ||
name: x86_64-unknown-linux-musl-so | ||
path: bound/kt/src/main/resources/ | ||
|
||
- name: Build and Test Kotlin Project | ||
run: | | ||
mkdir -p test-results | ||
# cd into the Kotlin project | ||
cd bound/kt/ | ||
mvn verify | ||
ls -la target/classes | ||
ls -l target | ||
# Set newly resolved version in POM config | ||
mvn \ | ||
versions:set \ | ||
--batch-mode \ | ||
-DnewVersion=${{ steps.resolve_version.outputs.resolved_version }} | ||
# Only attempt to publish artifact if we have credentials | ||
if [ -n "${{ secrets.ARTIFACTORY_PASSWORD }}" ]; then | ||
# Maven deploy lifecycle will build, run tests, verify, sign, and deploy | ||
mvn deploy --batch-mode --settings .maven_settings.xml -P sign-artifacts | ||
else | ||
# Otherwise, Maven verify lifecycle will build, run tests, and verify | ||
mvn verify --batch-mode | ||
fi | ||
env: | ||
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
SIGN_KEY_PASS: ${{ secrets.GPG_SECRET_PASSPHRASE }} | ||
SIGN_KEY: ${{ secrets.GPG_SECRET_KEY }} | ||
|
||
- name: Upload Kotlin Test Results | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
|