Skip to content

v1.11.8

v1.11.8 #16

# This workflow runs when a GitHub release is published.
#
# It validates that the tag correctly matches the library version, and then publishes
# artifacts for the release. Currently, this includes uploading the compiled Jar to
# the GitHub release. However, it should be extended to also include PGP signing and
# uploading to Maven Central.
#
# This workflow is almost a reusable workflow that can be used by any of our Gradle/JVM
# libraries. In order to make it reusable, we need to move it to a separate repo, update
# the workflow trigger ('on') to be 'workflow_call', and define inputs for any context
# that needs to be passed in.
#
# See https://docs.github.com/en/actions/using-workflows/reusing-workflows
#
# TODO: Consider whether we should merge this with the "prepare-release" workflow rather
# than having separate workflows.
name: "Publish Release Artifacts"
on:
release:
types: [published]
permissions:
contents: read
jobs:
publish-to-github-release:
runs-on: "codebuild-ion-java-${{ github.run_id }}-${{ github.run_attempt }}-arm-3.0-large"
permissions:
contents: write
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v3.6.0
with:
submodules: recursive
- name: Validate project version matches tag
shell: bash
run: |
RELEASE_TAG=${GITHUB_REF#refs/tags/}
# the tag should start with `v`, so prepend `v` to the contents of project.version
PROJECT_VERSION="v$(<project.version)"
echo "Project Version: $PROJECT_VERSION"
echo "Release Tag: $RELEASE_TAG"
[ "$PROJECT_VERSION" = "$RELEASE_TAG" ] || exit 1
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: 'corretto'
java-version: |
8
11
17
21
- uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43
with:
validate-wrappers: true
- name: Build Release Artifacts
run: ./gradlew build cyclonedxBom
- name: Publish to Sonatype
run: ./gradlew publishToSonatype
- name: Close and Release Sonatype Staging Repository
run: ./gradlew closeAndReleaseSonatypeStagingRepository
- name: Upload Artifacts to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TODO - reusability
# the location of the library(s) should be configurable as an input
# parameter rather than being hard coded as `build/libs/ion-java...`
# It may also need to be able to upload more than one file.
run: |
gh release upload "v$(<project.version)" "build/libs/ion-java-$(<project.version).jar"
gh release upload "v$(<project.version)" "build/reports/bom.json"