Skip to content
Merged
Changes from 2 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
63 changes: 59 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Release
on:
workflow_dispatch:
inputs:
recover_maven_central:
description: Republish only the main Maven Central bundle for an existing release
required: false
default: false
type: boolean

permissions:
contents: read
Expand Down Expand Up @@ -28,8 +34,8 @@ jobs:
needs:
- common
outputs:
version: ${{ steps.create-github-release.outputs.version }}
prior-version: ${{ steps.create-github-release.outputs.prior-version }}
version: ${{ steps.release-info.outputs.version }}
prior-version: ${{ steps.release-info.outputs.prior-version }}
steps:
- run: |
if [[ $GITHUB_REF_NAME != release/* ]]; then
Expand Down Expand Up @@ -64,6 +70,22 @@ jobs:
echo "VERSION=$version" >> $GITHUB_ENV
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV

- name: Validate Maven Central recovery
if: inputs.recover_maven_central
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! gh release view "v$VERSION" > /dev/null; then
echo "GitHub release v$VERSION does not exist"
exit 1
fi

artifact_url="https://repo1.maven.org/maven2/io/opentelemetry/javaagent/opentelemetry-javaagent/$VERSION/opentelemetry-javaagent-$VERSION.jar"
if curl --silent --head --fail "$artifact_url" > /dev/null; then
echo "Version $VERSION is already available from Maven Central"
exit 1
fi
Comment thread
trask marked this conversation as resolved.
Outdated

# check out main branch to verify there won't be problems with merging the change log
# at the end of this workflow
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
Expand Down Expand Up @@ -98,6 +120,7 @@ jobs:
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0

- name: Build and publish artifacts
if: ${{ !inputs.recover_maven_central }}
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
Expand All @@ -106,7 +129,30 @@ jobs:
# run: ./gradlew assemble spdxSbom publishToSonatype closeAndReleaseSonatypeStagingRepository
run: ./gradlew assemble spdxSbom publishAllPublicationToReleaseRepoRepository generateReleaseBundle uploadReleaseBundle

- name: Build Maven Central recovery bundle
if: inputs.recover_maven_central
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
run: ./gradlew assemble spdxSbom publishAllPublicationToReleaseRepoRepository generateReleaseBundle

- name: Verify recovered javaagent
if: inputs.recover_maven_central
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download "v$VERSION" --pattern opentelemetry-javaagent.jar --dir /tmp/release
cmp /tmp/release/opentelemetry-javaagent.jar javaagent/build/libs/opentelemetry-javaagent-${VERSION}.jar

- name: Upload Maven Central recovery bundle
if: inputs.recover_maven_central
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
run: ./gradlew uploadReleaseBundle -x generateReleaseBundle

- name: Build and publish gradle plugins
if: ${{ !inputs.recover_maven_central }}
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
Expand All @@ -119,18 +165,21 @@ jobs:
working-directory: gradle-plugins

- name: Collect SBOMs
if: ${{ !inputs.recover_maven_central }}
run: |
mkdir sboms
cp javaagent/build/spdx/*.spdx.json sboms
zip opentelemetry-java-instrumentation-SBOM.zip sboms/*

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
name: Upload SBOMs
if: ${{ !inputs.recover_maven_central }}
with:
name: opentelemetry-java-instrumentation-SBOM
path: "sboms/*.json"

- name: Generate release notes
if: ${{ !inputs.recover_maven_central }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -157,18 +206,20 @@ jobs:
fi

- name: Simplify paths for attaching
if: ${{ !inputs.recover_maven_central }}
run: |
cp javaagent/build/libs/opentelemetry-javaagent-${VERSION}.jar opentelemetry-javaagent.jar
cp javaagent/build/libs/opentelemetry-javaagent-${VERSION}.jar.asc opentelemetry-javaagent.jar.asc

- uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
if: ${{ !inputs.recover_maven_central }}
with:
subject-path: |
opentelemetry-javaagent.jar
opentelemetry-java-instrumentation-SBOM.zip

- id: create-github-release
name: Create GitHub release
- name: Create GitHub release
if: ${{ !inputs.recover_maven_central }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -180,11 +231,15 @@ jobs:
opentelemetry-javaagent.jar.asc \
opentelemetry-java-instrumentation-SBOM.zip

- id: release-info
name: Set release information
run: |
# these are used as job outputs
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "prior-version=$PRIOR_VERSION" >> $GITHUB_OUTPUT

documentation-audit:
if: ${{ !inputs.recover_maven_central }}
permissions:
contents: read
issues: write
Expand Down
Loading