-
Notifications
You must be signed in to change notification settings - Fork 301
57 lines (48 loc) · 1.83 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Release
on:
push:
branches:
- main
env:
THIRD_PARTY_GIT_AUTHOR_EMAIL: [email protected]
THIRD_PARTY_GIT_AUTHOR_NAME: nr-opensource-bot
jobs:
generate-third-party-notices:
runs-on: ubuntu-latest
steps:
# Checkout fetch-depth: 2 because there's a check to see if package.json
# was updated, and need at least 2 commits for the check to function properly
- name: Checkout repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
fetch-depth: 2
- name: Setup workspace
uses: "./.github/actions/bootstrap"
- name: Install OSS CLI
working-directory: ./utils
run: |
yarn global add @newrelic/newrelic-oss-cli
- name: Generate Third Party Notices
id: generate-notices
working-directory: ./utils
run: |
if [ ! -f "third_party_manifest.json" ]; then
echo "::error::third_party_manifest.json is missing. Must generate using the newrelic-oss-cli."
exit 1
fi
# latest commit
LATEST_COMMIT=$(git rev-parse HEAD)
# latest commit where package.json was changed
LAST_CHANGED_COMMIT=$(git log -1 --format=format:%H --full-diff package.json)
if [ $LAST_CHANGED_COMMIT = $LATEST_COMMIT ]; then
git config user.email "${{ env.BOT_EMAIL }}"
git config user.name "${{ env.BOT_NAME }}"
oss third-party manifest
oss third-party notices
git add third_party_manifest.json
git add THIRD_PARTY_NOTICES.md
git commit -m 'chore: update third-party manifest and notices [skip-cd]'
echo "commit=true" >> $GITHUB_ENV
else
echo "No change in package.json, not regenerating third-party notices"
fi