Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated release #296

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci-low-cadence.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: Continuous Integration (Low Cadence)

on:
workflow_call:
workflow_dispatch:
repository_dispatch:
types: run-slow-tests
schedule:
- cron: '0 0,12 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ci-low-cadence-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration

on:
workflow_call:
workflow_dispatch:
push:
branches:
Expand All @@ -13,7 +14,7 @@ on:
- 'release/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "CodeQL"

on:
workflow_call:
workflow_dispatch:
push:
branches:
Expand All @@ -13,7 +14,7 @@ on:
- release/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: codeql-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down
141 changes: 141 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.22.0-SNAPSHOT