diff --git a/.github/workflows/ci-low-cadence.yml b/.github/workflows/ci-low-cadence.yml index fbeedeabd..04b063249 100644 --- a/.github/workflows/ci-low-cadence.yml +++ b/.github/workflows/ci-low-cadence.yml @@ -1,6 +1,7 @@ name: Continuous Integration (Low Cadence) on: + workflow_call: workflow_dispatch: repository_dispatch: types: run-slow-tests @@ -8,7 +9,7 @@ on: - cron: '0 0,12 * * *' concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ci-low-cadence-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 632def8f4..1d2cfc7c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: Continuous Integration on: + workflow_call: workflow_dispatch: push: branches: @@ -13,7 +14,7 @@ on: - 'release/**' 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 7ca911780..9de527eb9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,6 +1,7 @@ name: "CodeQL" on: + workflow_call: workflow_dispatch: push: branches: @@ -13,7 +14,7 @@ on: - release/** 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 000000000..41dbcc632 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,141 @@ +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 + + ci-low-cadence: + uses: ./.github/workflows/ci-low-cadence.yml + + codeql: + uses: ./.github/workflows/codeql.yml + + pre-release: + name: Update version, tag repo, and return sha + permissions: + contents: write + needs: [ ci, ci-low-cadence, codeql ] + runs-on: ubuntu-latest + steps: + - id: checkout + if: ${{ inputs.release }} + name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - id: validate + if: ${{ inputs.release }} + name: Validate no new commits + run: | + if test $(git rev-parse HEAD) != '${{ github.sha }}' + then exit 1 + fi + - id: tag-version + if: ${{ inputs.release }} + name: Update version, tag repo, and return current SHA + 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 commit -m "${{ inputs.release-version }} version update." + git push + git tag ${{ inputs.release-version }} + git push origin refs/tags/${{ inputs.release-version }} + + 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: ${{ inputs.release && inputs.release-version || github.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 a release + run: ./gradlew publish + env: + SIGNING_GPG_SECRET_KEY: ${{ secrets.signingKey }} + SIGNING_GPG_PASSWORD: ${{ secrets.signingPassword }} + OSSRH_USERNAME: ${{ secrets.ossrhUsername }} + OSSRH_PASSWORD: ${{ secrets.ossrhPassword }} + + github-release: + if: ${{ inputs.release }} + name: Create Github Release after release + permissions: + contents: write + needs: release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.release-version }} + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ inputs.release-version }} + release_name: Release ${{ inputs.release-version }} + draft: true + + post-release: + if: ${{ inputs.release }} + name: Update version after release + 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 + 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 ca075629c..be126538b 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ def jmhVersion = '1.37' def jcstressVersion = '0.16' def agronaGroup = 'org.agrona' -def agronaVersion = '1.22.0-SNAPSHOT' +def agronaVersion = file('version.txt').text.trim() def getConfigProperty(final String projectPropertyName, final String envVarName) { String value = project.findProperty(projectPropertyName) diff --git a/version.txt b/version.txt new file mode 100644 index 000000000..d8c67589c --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.22.0-SNAPSHOT