Merge pull request #2494 from newrelic/release #1466
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 | |
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@692973e3d937129bcbf40652eb9f2f61becf3332 | |
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 |