Skip to content

Commit 9210f37

Browse files
Add release instructions (#16)
* Add release instructions * Apply suggestions from code review Co-authored-by: William Armiros <[email protected]> * Cleanup * Comments Co-authored-by: William Armiros <[email protected]>
1 parent dc074fb commit 9210f37

File tree

2 files changed

+219
-0
lines changed

2 files changed

+219
-0
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Releases a patch by cherrypicking commits into a release branch based on the previous
2+
# release tag.
3+
name: Patch Release Build
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: The version to tag the release with, e.g., 1.2.1, 1.2.2
9+
required: true
10+
commits:
11+
description: Comma separated list of commit shas to cherrypick
12+
13+
jobs:
14+
# Runs once for a patch series to any given minor version to create the initial release branch. Subsequent patches
15+
# will be applied to the existing release branch.
16+
prepare-release-branch:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
release-branch-name: ${{ steps.parse-release-branch.outputs.release-branch-name }}
20+
steps:
21+
- id: parse-release-branch
22+
name: Parse release branch name
23+
run: |
24+
# Sets the release-branch-name output to the version number with the last non-period element replaced with an 'x' and preprended with v.
25+
echo "::set-output name=release-branch-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.x/')"
26+
# Sets the release-tag-name output to the version number with the last non-period element replace with a '0' and prepended with v
27+
echo "::set-output name=release-tag-name::$(echo '${{ github.event.inputs.version }}' | sed -E 's/([^.]+)\.([^.]+)\.([^.]+)/v\1.\2.0/')"
28+
- id: checkout-release-branch
29+
name: Check out release branch
30+
# Will fail if there is no release branch yet or succeed otherwise
31+
continue-on-error: true
32+
uses: actions/checkout@v2
33+
with:
34+
ref: ${{ steps.parse-release-branch.outputs.release-branch-name }}
35+
- id: checkout-release-tag
36+
name: Check out release tag
37+
# If there is already a release branch, the previous step succeeds and we don't run this or the next one.
38+
if: ${{ steps.checkout-release-branch.outcome == 'failure' }}
39+
uses: actions/checkout@v2
40+
with:
41+
ref: ${{ steps.parse-release-branch.outputs.release-tag-name }}
42+
- name: Create release branch
43+
if: ${{ steps.checkout-release-tag.outcome == 'success' }}
44+
run: |
45+
git checkout -b ${{ steps.parse-release-branch.outputs.release-branch-name }}
46+
git push --set-upstream origin ${{ steps.parse-release-branch.outputs.release-branch-name }}
47+
build:
48+
runs-on: ubuntu-latest
49+
needs: prepare-release-branch
50+
steps:
51+
- name: Checkout release branch
52+
uses: actions/checkout@v2
53+
with:
54+
ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }}
55+
56+
- uses: actions/setup-java@v1
57+
with:
58+
java-version: 14
59+
60+
- name: Setup git name
61+
run: |
62+
git config user.name github-actions
63+
git config user.email [email protected]
64+
65+
- name: Cherrypicks
66+
if: ${{ github.event.inputs.commits != '' }}
67+
run: |
68+
git fetch origin master
69+
echo ${{ github.event.inputs.commits }} | sed -n 1'p' | tr ',' '\n' | while read word; do
70+
# Trim whitespaces and cherrypick
71+
echo $word | sed 's/ *$//g' | sed 's/^ *//g' | git cherry-pick --stdin
72+
done
73+
74+
- name: Build release with Gradle
75+
uses: burrunan/gradle-cache-action@v1
76+
with:
77+
arguments: build jibDockerBuild final -Prelease.version=${{ github.event.inputs.version }} --stacktrace
78+
env:
79+
PUBLISH_USERNAME: ${{ github.actor }}
80+
PUBLISH_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
81+
GRGIT_USER: ${{ github.actor }}
82+
GRGIT_PASS: ${{ secrets.GITHUB_TOKEN }}
83+
AWS_REGISTRY_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
84+
COMMIT_HASH: ${{ github.event.inputs.version }}
85+
86+
- name: Configure AWS credentials
87+
uses: aws-actions/configure-aws-credentials@v1
88+
with:
89+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
90+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
91+
aws-region: us-west-2
92+
93+
- name: Login to Amazon ECR
94+
id: login-ecr
95+
uses: aws-actions/amazon-ecr-login@v1
96+
97+
- name: Push image to Amazon ECR
98+
env:
99+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
100+
run: |
101+
docker images
102+
docker push $ECR_REGISTRY/springboot:${{ github.event.inputs.version }}
103+
docker push $ECR_REGISTRY/spark:${{ github.event.inputs.version }}
104+
105+
- name: Create Release
106+
id: create_release
107+
uses: actions/create-release@v1
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
with:
111+
tag_name: v${{ github.event.inputs.version }}
112+
release_name: Release v${{ github.event.inputs.version }}
113+
draft: true
114+
prerelease: false
115+
116+
- name: Upload Release Asset
117+
id: upload-release-asset
118+
uses: actions/upload-release-asset@v1
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
with:
122+
upload_url: ${{ steps.create_release.outputs.upload_url }}
123+
asset_path: otelagent/build/libs/aws-opentelemetry-agent-${{ github.event.inputs.version }}.jar
124+
asset_name: aws-opentelemetry-agent.jar
125+
asset_content_type: application/java-archive

RELEASING.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# AWS OpenTelemetry Java Instrumentation Release Process
2+
3+
## Starting the Release
4+
5+
Open the release build workflow in your browser [here](https://github.com/aws-observability/aws-otel-java-instrumentation/actions?query=workflow%3A%22Release+Build%22).
6+
7+
You will see a button that says "Run workflow". Press the button, enter the version number you want
8+
to release in the input field that pops up, and then press "Run workflow".
9+
10+
This triggers the release process, which builds the artifacts, updates the README with the new
11+
version numbers, commits the change to the README, publishes the artifacts, creates and pushes
12+
a git tag with the version number, and drafts a release with the agent artifact attached.
13+
14+
## Announcement
15+
16+
Once the GitHub workflow completes, go to Github [release
17+
page](https://github.com/aws-observability/aws-otel-java-instrumentation/releases), and find the
18+
generated draft release to write release notes about the new release.
19+
20+
You can use `git log upstream/v$MAJOR.$((MINOR-1)).x..upstream/v$MAJOR.$MINOR.x --graph --first-parent`
21+
or the Github [compare tool](https://github.com/open-telemetry/opentelemetry-java/compare/)
22+
to view a summary of all commits since last release as a reference.
23+
24+
## Patch Release
25+
26+
All patch releases should include only bug-fixes, and must avoid
27+
adding/modifying the public APIs.
28+
29+
Open the patch release build workflow in your browser [here](https://github.com/aws-observability/aws-otel-java-instrumentation/actions?query=workflow%3A%22Patch+Release+Build%22).
30+
31+
You will see a button that says "Run workflow". Press the button, enter the version number you want
32+
to release in the input field for version that pops up and the commits you want to cherrypick for the
33+
patch as a comma-separated list. Then, press "Run workflow".
34+
35+
If the commits cannot be cleanly applied to the release branch, for example because it has diverged
36+
too much from main, then the workflow will fail before building. In this case, you will need to
37+
prepare the release branch manually.
38+
39+
This example will assume patching into release branch `v1.2.x` from a git repository with remotes
40+
named `origin` and `upstream`.
41+
42+
```
43+
$ git remote -v
44+
origin [email protected]:username/opentelemetry-java.git (fetch)
45+
origin [email protected]:username/opentelemetry-java.git (push)
46+
upstream [email protected]:open-telemetry/opentelemetry-java.git (fetch)
47+
upstream [email protected]:open-telemetry/opentelemetry-java.git (push)
48+
```
49+
50+
First, checkout the release branch
51+
52+
```
53+
git fetch upstream v1.2.x
54+
git checkout upstream/v1.2.x
55+
```
56+
57+
Apply cherrypicks manually and commit. It is ok to apply multiple cherrypicks in a single commit.
58+
Use a commit message such as "Manual cherrypick for commits commithash1, commithash2".
59+
60+
After commiting the change, push to your fork's branch.
61+
62+
```
63+
git push origin v1.2.x
64+
```
65+
66+
Create a PR to have code review and merge this into upstream's release branch. As this was not
67+
applied automatically, we need to do code review to make sure the manual cherrypick is correct.
68+
69+
After it is merged, Run the patch release workflow again, but leave the commits input field blank.
70+
The release will be made with the current state of the release branch, which is what you prepared
71+
above.
72+
73+
## Release candidates
74+
75+
Release candidate artifacts are released using the same process described above. The version schema for release candidates
76+
is`v1.2.3-RC$`, where `$` denotes a release candidate version, e.g. `v1.2.3-RC1`.
77+
78+
## Credentials
79+
80+
The following credentials are required for publishing (and automatically set in CI):
81+
82+
* `PUBLISH_USERNAME` and `PUBLISH_PASSWORD`: Sonatype credentials for publishing.
83+
84+
## Releasing from the local setup
85+
86+
Releasing from the local setup can be done providing the previously mentioned four credential values, i.e.
87+
`PUBLISH_USERNAME`, `PUBLISH_PASSWORD`
88+
89+
```sh
90+
export PUBLISH_USERNAME=my_sonatype_user
91+
export PUBLISH_PASSWORD=my_sonatype_key
92+
export RELEASE_VERSION=2.4.5 # Set version you want to release
93+
./gradlew build final -Prelease.version=${RELEASE_VERSION}
94+
```

0 commit comments

Comments
 (0)