diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20a419ceb5..8535c492ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: Continuous Integration on: + workflow_call: push: branches: - master @@ -10,7 +11,7 @@ on: - master concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ci-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2926e37390..f1ede3ac02 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,6 +1,7 @@ name: "CodeQL" on: + workflow_call: push: branches: - master @@ -10,7 +11,7 @@ on: - master concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: codeql-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..34f9354c4a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,124 @@ +name: Release + +on: + workflow_dispatch: + inputs: + release: + description: Is release? (Will create tag and update version) + required: true + default: false + type: boolean + release-version: + description: Released version (x.y.z) + required: true + type: string + next-version: + description: Next version (x.y.z) + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +env: + GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.java.installations.auto-detect=false -Dorg.gradle.warning.mode=fail' + +jobs: + ci: + uses: ./.github/workflows/ci.yml + + codeql: + uses: ./.github/workflows/codeql.yml + + pre-release: + name: Update version, tag repo, and return sha + permissions: + contents: write + needs: [ ci, codeql ] + runs-on: ubuntu-latest + outputs: + sha: ${{ steps.return-sha.outputs.sha }} + steps: + - id: checkout + name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - id: validate + name: Validate no new commits + run: | + current_sha=$(git rev-parse HEAD) + if test $current_sha != '${{ github.sha }}' + then exit 1 + fi + - id: tag-version + if: ${{ inputs.release }} + name: Update version and tag repo + run: | + git config user.name "github-actions" + git config user.email "github-actions@aeron.io" + echo ${{ inputs.release-version }} > version.txt + git add version.txt + git status + git commit -m "${{ inputs.release-version }} version update." + git push + git tag ${{ inputs.release-version }} + git push origin refs/tags/${{ inputs.release-version }} + - id: return-sha + name: Return current SHA + run: | + git rev-parse HEAD + echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + release: + name: Release java artifacts + permissions: + contents: read + packages: write + needs: pre-release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ needs.pre-release.outputs.sha }} + - name: Setup java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 8 + - name: Setup BUILD_JAVA_HOME & BUILD_JAVA_VERSION + run: | + java -Xinternalversion + echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV + echo "BUILD_JAVA_VERSION=8" >> $GITHUB_ENV + - name: Publish with Gradle to Open Source + run: ./gradlew publishAllPublicationsToOssRepository + env: + ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.osshrUsername }} + ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.osshrPassword }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }} + + post-release: + name: Update version + permissions: + contents: write + needs: release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Commit snapshot version to current branch + if: ${{ inputs.release }} + run: | + git config user.name "github-actions" + git config user.email "github-actions@aeron.io" + echo ${{ inputs.next-version }}-SNAPSHOT > version.txt + git add version.txt + git status + git commit -m "${{ inputs.next-version }}-SNAPSHOT version update." + git push \ No newline at end of file diff --git a/build.gradle b/build.gradle index b84af9d198..ebb55337e7 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ def agronaVersion = '1.21.2' def sbeVersion = '1.31.1' def aeronVersion = '1.44.1' def artioGroup = 'uk.co.real-logic' -def iLink3Enabled = false +def artioVersion = file('version.txt').text.trim() defaultTasks 'clean', 'build' @@ -102,7 +102,9 @@ def projectPom = { ext { group = artioGroup - isReleaseVersion = !version.endsWith("SNAPSHOT") + isReleaseVersion = !artioVersion.endsWith("SNAPSHOT") + repoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' iLink3Enabled = Boolean.getBoolean("fix.core.iLink3Enabled") if (!project.hasProperty('repoUsername')) { @@ -113,12 +115,12 @@ ext { repoPassword = '' } - if (!project.hasProperty('repoUrl')) { - repoUrl = '' + if (!project.hasProperty('signingKey')) { + signingKey = null } - if (!project.hasProperty('snapshotUrl')) { - snapshotUrl = '' + if (!project.hasProperty('signingPassword')) { + signingPassword = null } } @@ -158,7 +160,7 @@ subprojects { apply plugin: 'checkstyle' group = artioGroup - version = version + version = artioVersion def toolchainLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(buildJavaVersion) @@ -286,6 +288,9 @@ subprojects { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") } sign configurations.archives } @@ -364,6 +369,9 @@ project(':artio-codecs') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioCodecs } } @@ -444,6 +452,9 @@ project(':artio-ilink3-codecs') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioILink3Codecs } } @@ -521,6 +532,9 @@ project(':artio-binary-entrypoint-codecs') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioBinaryEntrypointCodecs } } @@ -544,6 +558,9 @@ project(':artio-binary-entrypoint-impl') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioBinaryEntrypointImpl } } @@ -575,6 +592,9 @@ project(':artio-ilink3-impl') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioIlink3Impl } } @@ -641,6 +661,9 @@ project(':artio-session-codecs') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioSessionCodecs } } @@ -702,6 +725,9 @@ project(':artio-session-fixt-codecs') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioSessionFixtCodecs } } @@ -734,6 +760,9 @@ project(':artio-core') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioCore } } @@ -795,6 +824,9 @@ project(':artio-system-tests') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioSystemTests } } @@ -830,6 +862,9 @@ project(':artio-ilink-system-tests') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioILink3SystemTests } } @@ -860,6 +895,9 @@ project(':artio-binary-entrypoint-system-tests') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioBinaryEntrypointSystemTests } } @@ -892,6 +930,9 @@ project(':artio-samples') { } signing { + if (signingKey != null) { + useInMemoryPgpKeys(signingKey, signingPassword) + } sign publishing.publications.artioSamples } } diff --git a/version.txt b/version.txt new file mode 100644 index 0000000000..95bcb22fea --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.154-SNAPSHOT