Skip to content

Release sigstore-java and sigstore-maven-plugin to Maven Central #18

Release sigstore-java and sigstore-maven-plugin to Maven Central

Release sigstore-java and sigstore-maven-plugin to Maven Central #18

name: Release sigstore-java and sigstore-maven-plugin to Maven Central
on:
workflow_dispatch:
# user is expected to use a tag as the branch to run the action on
jobs:
process-tag:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false
- name: process tag
id: version
env:
TAG: ${{ github.ref_name }}
run: |
echo "version=${TAG#"v"}" >> $GITHUB_OUTPUT
- name: verify tag matches gradle version
env:
TAG_VERSION: ${{ steps.version.outputs.version }}
REF: ${{ github.ref }}
run: |
set -Eeo pipefail
version=$(grep "^version=" gradle.properties | cut -d'=' -f2)
if [[ ! "$version" == "${TAG_VERSION}" ]]; then
echo "tagged version ${REF} (as ${TAG_VERSION}) does not match gradle.properties $version"
exit 1
fi
ci:
needs: [process-tag]
permissions:
id-token: write # To run github oidc tests
uses: ./.github/workflows/ci.yaml
build:
permissions:
id-token: write # To sign the artifacts
runs-on: ubuntu-latest
needs: [ci]
steps:
- name: checkout tag
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false
- name: Set up JDK 21
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
java-version: 21
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@748248ddd2a24f49513d8f472f81c3a07d4d50e1 # v4.4.4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@c200f3691d83b41bf9bbd8638997a462592937ed # v2.1.13
with:
workload_identity_provider: projects/306323169285/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
service_account: [email protected]
- uses: google-github-actions/get-secretmanager-secrets@2b5f97c5a4b9c105e64646762ad4fc3f5128e6f5 # v2.2.5
id: secrets
with:
secrets: |-
signing_key:sigstore-secrets/sigstore-java-pgp-priv-key
signing_password:sigstore-secrets/sigstore-java-pgp-priv-key-password
sonatype_username:sigstore-secrets/sigstore-sonatype-central-portal-username
sonatype_password:sigstore-secrets/sigstore-sonatype-central-portal-password
- name: Build, Sign and Release to Maven Central
env:
ORG_GRADLE_PROJECT_signingKey: ${{ steps.secrets.outputs.signing_key }}
ORG_GRADLE_PROJECT_signingPassword: ${{ steps.secrets.outputs.signing_password }}
CENTRAL_PORTAL_USERNAME: ${{ steps.secrets.outputs.sonatype_username }}
CENTRAL_PORTAL_PASSWORD: ${{ steps.secrets.outputs.sonatype_password }}
run: |
./gradlew clean :publishAggregationToCentralPortal -Prelease -Porg.gradle.java.installations.auto-download=false
create-release-on-github:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
steps:
- name: Create release
env:
REF_NAME: ${{ github.ref_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create -R ${{ github.repository }} -t "${REF_NAME}" ${REF_NAME} -n "See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for more details."