Release #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| release: | |
| permissions: | |
| contents: write # for creating the release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.create-github-release.outputs.version }} | |
| steps: | |
| - run: | | |
| if [[ $GITHUB_REF_NAME != release/* ]]; then | |
| echo this workflow should only be run against release branches | |
| exit 1 | |
| fi | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| - name: Build and publish artifacts | |
| run: ./gradlew assemble publishToSonatype closeAndReleaseSonatypeStagingRepository | |
| env: | |
| SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
| SONATYPE_KEY: ${{ secrets.SONATYPE_KEY }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
| - name: Set environment variables | |
| run: | | |
| version=$(.github/scripts/get-version.sh) | |
| echo "VERSION=$version" >> $GITHUB_ENV | |
| - name: Generate release notes | |
| run: | | |
| cat > /tmp/release-notes.txt << EOF | |
| Java Bindings for [OTLP v$VERSION](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v$VERSION) | |
| EOF | |
| - id: create-github-release | |
| name: Create GitHub release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create --target $GITHUB_REF_NAME \ | |
| --title "Version $VERSION" \ | |
| --notes-file /tmp/release-notes.txt \ | |
| v$VERSION | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT |