Skip to content

Commit e2d65f0

Browse files
authored
Merge pull request #4 from newrelic-experimental/fix_build
updated release.yml
2 parents 733f3b2 + 6208409 commit e2d65f0

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
name: Build and Release (Manual Run) v1.3
1+
name: Build and Release (Manual Run) v1.4
22

3-
on:
4-
workflow_dispatch: # This event allows manual triggering
3+
on:
4+
workflow_dispatch: # This event allows manual triggering
5+
6+
env:
7+
THIRD_PARTY_GIT_AUTHOR_EMAIL: opensource+bot@newrelic.com
8+
THIRD_PARTY_GIT_AUTHOR_NAME: nr-opensource-bot
59

610
jobs:
711
build-and-release:
@@ -12,12 +16,12 @@ jobs:
1216
uses: actions/checkout@v3
1317
with:
1418
fetch-depth: 0
15-
1619

17-
- name: Set up JDK 8
20+
21+
- name: Set up JDK 17
1822
uses: actions/setup-java@v3
1923
with:
20-
java-version: 8
24+
java-version: 17
2125
distribution: 'temurin'
2226

2327

@@ -32,29 +36,29 @@ jobs:
3236
- name: Build with Gradle and verifyInstrumentation
3337
run: |
3438
. ./newrelic-dependencies.sh
35-
./gradlew clean build install verifyInstrumentation
39+
./gradlew clean install verifyInstrumentation
3640
3741
- name: Identify Release Type
3842
id: define_release_type
3943
run: |
40-
echo "Generating changelog to check type of release..."
41-
old_tag=$(git describe --abbrev=0 --tags 2>/dev/null) || true
42-
if [[ -n "$old_tag" ]]; then
43-
changelog=$(git log --pretty=format:"- %s (%h)" $old_tag..HEAD)
44-
fi
45-
if echo "$changelog" | grep -iqE '\bBREAKING CHANGE\b'; then
46-
echo "RELEASE_TYPE=major" >> $GITHUB_ENV
47-
elif echo "$changelog" | grep -iqE '\bfeat\b'; then
48-
echo "RELEASE_TYPE=minor" >> $GITHUB_ENV
49-
else
50-
echo "RELEASE_TYPE=patch" >> $GITHUB_ENV
51-
fi
52-
44+
echo "Generating changelog to check type of release..."
45+
old_tag=$(git describe --abbrev=0 --tags 2>/dev/null) || true
46+
if [[ -n "$old_tag" ]]; then
47+
changelog=$(git log --pretty=format:"- %s (%h)" $old_tag..HEAD)
48+
fi
49+
if echo "$changelog" | grep -iqE '\bBREAKING CHANGE\b'; then
50+
echo "RELEASE_TYPE=major" >> $GITHUB_ENV
51+
elif echo "$changelog" | grep -iqE '\bfeat\b'; then
52+
echo "RELEASE_TYPE=minor" >> $GITHUB_ENV
53+
else
54+
echo "RELEASE_TYPE=patch" >> $GITHUB_ENV
55+
fi
56+
5357
- name: Set release version
5458
id: set_release_version
5559
run: |
5660
major_version=1
57-
minor_version=0
61+
minor_version=4
5862
patch_revision=1
5963
6064
# Retrieve the latest release tag
@@ -66,7 +70,7 @@ jobs:
6670
current_major_version=$(echo $latest_tag | cut -d'.' -f1 | sed 's/v//')
6771
current_minor_version=$(echo $latest_tag | cut -d'.' -f2)
6872
current_patch_revision=$(echo $latest_tag | cut -d'.' -f3)
69-
73+
7074
if [ "${{ env.RELEASE_TYPE }}" = "major" ]; then
7175
major_version=$((current_major_version +1 ))
7276
elif [ "${{ env.RELEASE_TYPE }}" = "minor" ]; then
@@ -77,7 +81,7 @@ jobs:
7781
minor_version=$((current_minor_version))
7882
major_version=$((current_major_version))
7983
fi
80-
84+
8185
fi
8286
8387
# Set the release version environment variable
@@ -103,13 +107,13 @@ jobs:
103107
zip -r /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip *.jar
104108
cd ${{env.CURRENT}}
105109
106-
110+
107111
108112
- name: Create Release
109113
id: create_release
110114
uses: actions/github-script@v6
111115
with:
112-
github-token: ${{ secrets.GITHUB_TOKEN }}
116+
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
113117
script: |
114118
try {
115119
var changelog = ``;
@@ -135,22 +139,22 @@ jobs:
135139
- name: Upload Release Artifacts
136140
uses: actions/upload-release-asset@v1
137141
env:
138-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142+
GITHUB_TOKEN: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
139143
with:
140144
asset_path: /tmp/to/${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip
141145
asset_name: ${{ env.RELEASE_NAME}}${{ steps.set_tag.outputs.tag }}.zip
142146
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
143147
asset_content_type: application/zip
144-
148+
145149
- name: "Generate release changelog"
146150
id: github_changelog
147151
uses: Helmisek/conventional-changelog-generator@v1.0.6-release
148152
with:
149-
repo-token: ${{ secrets.GITHUB_TOKEN }}
153+
repo-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
150154
commit-types: "fix:Bug Fixes,feat:Features,doc:Documentation,build:Build Upgrades,BREAKING CHANGE:Enhancements"
151155
template-path: ".github/workflows/CHANGELOG.tpl.md"
152-
153-
156+
157+
154158
- name: update CHANGELOG.md
155159
run: |
156160
# Content to add at the top
@@ -177,23 +181,23 @@ jobs:
177181
git commit -m "Update Changelog for Release [skip ci]"
178182
179183
# Push the changes to the remote repository
180-
git push --quiet --set-upstream origin HEAD
181-
184+
# git push --quiet --set-upstream origin HEAD
185+
182186
- name: Get Compare URL
183187
run: |
184-
compare=$(echo ${{ env.RELEASE_URL }} | sed 's/releases\/tag.*/compare/')
185-
compareurl=$(echo "\nFull Changelog: ($compare/${{ env.LATEST_TAG }}...${{ steps.set_tag.outputs.tag }})")
186-
echo "COMPAREURL=${compareurl}" >> $GITHUB_ENV
187-
188+
compare=$(echo ${{ env.RELEASE_URL }} | sed 's/releases\/tag.*/compare/')
189+
compareurl=$(echo "\nFull Changelog: ($compare/${{ env.LATEST_TAG }}...${{ steps.set_tag.outputs.tag }})")
190+
echo "COMPAREURL=${compareurl}" >> $GITHUB_ENV
191+
188192
- name: Update Release
189193
id: update_release
190194
uses: actions/github-script@v6
191195
with:
192-
github-token: ${{ secrets.GITHUB_TOKEN }}
196+
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
193197
script: |
194198
try {
195-
196-
199+
200+
197201
var changelog = `${{steps.github_changelog.outputs.changelog}}` + `${{env.COMPAREURL}}` ;
198202
var release_id = `${{env.RELEASE_ID}}`;
199203
var tag = '' + `${{ steps.set_tag.outputs.tag }}`;
@@ -213,5 +217,4 @@ jobs:
213217
core.exportVariable('RELEASE_UPLOAD_URL', _response.data.upload_url);
214218
} catch (error) {
215219
core.setFailed(error.message);
216-
}
217-
220+
}

0 commit comments

Comments
 (0)