Skip to content

.github/workflows/release.yml #9

.github/workflows/release.yml

.github/workflows/release.yml #9

Workflow file for this run

---
name: Release
on:
workflow_dispatch:
inputs:
branch_specifier:
description: The branch to release e.g. main or release/0.1.0
required: true
default: "main"
type: string
release_type:
description: Specify the type of the release, final by default.
required: true
default: "final"
type: choice
options:
- "final"
- "snapshot"
jobs:
release:
name: "release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_specifier || 'main' }}
- name: Set up JDK for running Gradle
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17.0.6
- name: Build and publish artifacts
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Pfinal=${{ inputs.release_type == 'final' && 'true' || 'false' }}
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
- name: Create release tag for release builds
env:
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
if: "${{ inputs.release_type == 'final' }}"
run: |
VERSION_NUMBER=$(grep ^version= gradle.properties | sed -e 's/^.*=//')
VERSION="v${VERSION_NUMBER}"
git tag ${VERSION}
git push origin ${VERSION}