Release Build #57
This file contains 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 Build | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: The version to tag the release with, e.g., 1.2.0, 1.2.1-alpha.1 | |
required: true | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test | |
permissions: | |
id-token: write | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: Publish patched dependencies to maven local | |
uses: ./.github/actions/patch-dependencies | |
if: ${{ startsWith(github.ref_name, 'release/v') }} | |
with: | |
branch: ${{ github.ref_name }} | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_password: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Log in to AWS ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: public.ecr.aws | |
- name: Build release with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build integrationTests -PlocalDocker=true -Prelease.version=${{ github.event.inputs.version }} --stacktrace | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN_RELEASE }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Log in to AWS ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: public.ecr.aws | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image for testing | |
uses: docker/build-push-action@v5 | |
with: | |
push: false | |
build-args: "ADOT_JAVA_VERSION=${{ github.event.inputs.version }}" | |
context: . | |
platforms: linux/amd64 | |
tags: ${{ env.TEST_TAG }} | |
load: true | |
- name: Test docker image | |
shell: bash | |
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ github.event.inputs.version }}" | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
build-args: "ADOT_JAVA_VERSION=${{ github.event.inputs.version }}" | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v${{ github.event.inputs.version }} | |
- name: Build and Publish release with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build final closeAndReleaseSonatypeStagingRepository -Prelease.version=${{ github.event.inputs.version }} --stacktrace | |
env: | |
PUBLISH_USERNAME: ${{ secrets.PUBLISH_USERNAME }} | |
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }} | |
GRGIT_USER: ${{ secrets.GITHUB_TOKEN }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
run: | | |
cp "otelagent/build/libs/aws-opentelemetry-agent-${{ github.event.inputs.version }}.jar" aws-opentelemetry-agent.jar | |
gh release create --target "$GITHUB_REF_NAME" \ | |
--title "Release v${{ github.event.inputs.version }}" \ | |
--draft \ | |
"v${{ github.event.inputs.version }}" \ | |
aws-opentelemetry-agent.jar |