-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
THIRD_PARTY_GIT_AUTHOR_EMAIL: opensource+bot@newrelic.com | ||
THIRD_PARTY_GIT_AUTHOR_NAME: nr-opensource-bot | ||
|
||
jobs: | ||
job-generate-release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Add plugins for semantic release | ||
run: npm install @semantic-release/git @semantic-release/changelog | ||
|
||
- name: Temporarily disable branch protections | ||
id: disable-branch-protection | ||
if: always() | ||
uses: actions/github-script@v1 | ||
with: | ||
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }} | ||
previews: luke-cage-preview | ||
script: | | ||
const result = await github.repos.updateBranchProtection({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
branch: 'main', | ||
required_status_checks: null, | ||
restrictions: null, | ||
enforce_admins: null, | ||
required_pull_request_reviews: null | ||
}) | ||
console.log("Result:", result) | ||
- name: Run semantic-release | ||
env: | ||
# Use nr-opensource-bot for authoring commits done by | ||
# semantic-release (rather than using @semantic-release-bot) | ||
GIT_AUTHOR_NAME: "nr-opensource-bot" | ||
GIT_AUTHOR_EMAIL: "opensource+bot@newrelic.com" | ||
GIT_COMMITTER_NAME: "nr-opensource-bot" | ||
GIT_COMMITTER_EMAIL: "opensource+bot@newrelic.com" | ||
GITHUB_TOKEN: ${{ secrets.OPENSOURCE_BOT_TOKEN }} | ||
run: npx semantic-release | ||
|
||
- name: Re-enable branch protections | ||
id: enable-branch-protection | ||
if: always() | ||
uses: actions/github-script@v1 | ||
with: | ||
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }} | ||
previews: luke-cage-preview | ||
script: | | ||
const result = await github.repos.updateBranchProtection({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
branch: 'main', | ||
required_status_checks: { | ||
strict: true, | ||
contexts: [] | ||
}, | ||
restrictions: { | ||
"users":[], | ||
"teams":[], | ||
"apps":[] | ||
}, | ||
enforce_admins: null, | ||
required_pull_request_reviews: { | ||
dismiss_stale_reviews: true, | ||
required_approving_review_count: 1 | ||
} | ||
}) | ||
console.log("Result:", result) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
["@semantic-release/changelog", { | ||
"changelogFile": "CHANGELOG.md" | ||
}], | ||
"@semantic-release/github", | ||
["@semantic-release/git", { | ||
"assets": ["CHANGELOG.md"], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
}] | ||
], | ||
"dryRun": false, | ||
"debug": true | ||
} |