-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add release-toolkit auto-release
- Loading branch information
1 parent
38e93d7
commit cbf6778
Showing
4 changed files
with
124 additions
and
13 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
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,104 @@ | ||
name: Release on merge to main | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
BOT_NAME: newrelic-coreint-bot | ||
BOT_EMAIL: [email protected] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
test-release-needed: | ||
name: Test if release is needed | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# Validation and generation. | ||
- name: Validate that the markdown is correct | ||
uses: ./validate-markdown | ||
- name: Generate YAML | ||
uses: ./generate-yaml | ||
with: | ||
excluded-dirs: .github | ||
|
||
# Check that a release is needed. | ||
- name: Check if the release is empty | ||
id: empty | ||
uses: ./is-empty | ||
- name: Check if the release is held | ||
id: held | ||
uses: ./is-held | ||
- name: Output if the release should be skipped | ||
id: output | ||
shell: bash | ||
run: | | ||
echo "skip=${{ steps.empty.outputs.is-empty == 'true' || steps.held.outputs.is-held == 'true' }}" >> $GITHUB_OUTPUT | ||
outputs: | ||
make-release: ${{ steps.output.outputs.skip }} | ||
|
||
make-release: | ||
name: Test if release is needed | ||
runs-on: ubuntu-latest | ||
needs: [ test-release-needed ] | ||
if: ${{ needs.test-release-needed.outputs.make-release }} | ||
steps: | ||
- name: Generate YAML | ||
uses: ./generate-yaml | ||
with: | ||
excluded-dirs: .github | ||
|
||
# Put release toolkit to work. | ||
- name: Link dependencies | ||
uses: ./link-dependencies | ||
- name: Calculate next version | ||
id: version | ||
uses: ./next-version | ||
|
||
# Prepare to commit the Changelog. | ||
- name: Configure Git | ||
run: | | ||
git config user.name '${{ env.BOT_NAME }}' | ||
git config user.email '${{ env.BOT_EMAIL }}' | ||
# Create changelog and commit it. | ||
- name: Update the markdown | ||
uses: ./update-markdown | ||
with: | ||
version: ${{ steps.version.outputs.next-version }} | ||
- name: Commit updated changelog | ||
run: | | ||
git add CHANGELOG.md | ||
git commit -m "Update changelog with changes from ${{ steps.version.outputs.next-version }}" | ||
git push -u origin ${{ github.event.repository.default_branch }} | ||
# Create the release from the commit above using only the changelog for this release. | ||
- name: Render the changelog snippet | ||
uses: ./render | ||
with: | ||
version: ${{ steps.version.outputs.next-version }} | ||
- name: Create release | ||
run: | | ||
gh release create \ | ||
${{ steps.version.outputs.next-version }} \ | ||
--title ${{ steps.version.outputs.next-version }} \ | ||
--target $(git rev-parse HEAD) \ | ||
--notes-file CHANGELOG.partial.md | ||
notify: | ||
name: Test if release is needed | ||
runs-on: ubuntu-latest | ||
needs: [ test-release-needed, make-release ] | ||
steps: | ||
- name: Notify failure via Slack | ||
if: ${{ always() && failure() }} | ||
uses: archive/github-actions-slack@master | ||
with: | ||
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }} | ||
slack-channel: ${{ secrets.COREINT_SLACK_CHANNEL }} | ||
slack-text: "❌ `${{ github.repository }}`: [release pipeline failed](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." |
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,3 @@ | ||
/CHANGELOG.md.bak | ||
/CHANGELOG.md.partial | ||
/changelog.yaml |
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,5 @@ | ||
## v1.0.0 - 2023-11-02 | ||
|
||
### 🚀 Enhancements | ||
- First release of release toolkit | ||
|