Skip to content

Commit

Permalink
chore(ci): Automated release creation (#421)
Browse files Browse the repository at this point in the history
Signed-off-by: mrickard <maurice@mauricerickard.com>
  • Loading branch information
mrickard committed Mar 22, 2024
1 parent 89d350a commit 9a05e0b
Show file tree
Hide file tree
Showing 9 changed files with 549 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Thank you for submitting a Pull Request.
This code is leveraged to monitor critical services. Please consider the following:
* Tests are required.
* Performance matters.
* Features that are specific to just your app are unlikely to make it in.
Ensure that your Pull Request title adheres to our Conventional Commit standards
as described in CONTRIBUTING.md
Please update the Pull Request description to add relevant context or documentation about
the submitted change.
-->
## Description

Please provide a brief description of the changes introduced in this pull request.
What problem does it solve? What is the context of this change?

## How to Test

Please describe how you have tested these changes. Have you run the code against an example application?
What steps did you take to ensure that the changes are working correctly?

## Related Issues

Please include any related issues or pull requests in this section, using the format `Closes #<issue number>` or `Fixes #<issue number>` if applicable.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "npm"
# Disable version updates for npm dependencies, security updates don't use this configuration
# See: https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates
open-pull-requests-limit: 0
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "security"
prefix-development: "chore"
include: "scope"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate
name: NR Serverless Plugin CI

on: [push, pull_request, workflow_dispatch]

Expand All @@ -11,9 +11,9 @@ jobs:
matrix:
node-version: [lts/*]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
Expand All @@ -30,9 +30,9 @@ jobs:
matrix:
node-version: [lts/*]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Run Snapshot Tests
run: npm test
- name: Upload Unit Test Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Create Release

on: [workflow_dispatch]

jobs:
tag-and-publish:
uses: newrelic/node-newrelic/.github/workflows/release-creation.yml@main
with:
changelog_file: CHANGELOG.md
secrets:
npm_token: ${{ secrets.NODE_AGENT_NPM_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Prepare Release PR

on:
workflow_dispatch:
inputs:
release_type:
description: Type of release. patch or minor (major if breaking)
required: true
type: choice
default: patch
options:
- patch
- minor
- major

jobs:
release-notes:
uses: newrelic/node-newrelic/.github/workflows/prep-release.yml@main
with:
release_type: ${{ github.event.inputs.release_type }}
use_new_release: ${{ vars.USE_NEW_RELEASE }}
changelog_file: CHANGELOG.md
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
node-version: [lts/*]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3 # https://github.com/actions/setup-node
uses: actions/setup-node@v4 # https://github.com/actions/setup-node
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repolinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
return data.data && data.data.default_branch === context.ref.split('/').slice(-1)[0]
- name: Checkout Self
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run Repolinter
if: ${{ steps.default-branch.outputs.result == 'true' }}
uses: newrelic/repolinter-action@v1
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Validate Pull Request

permissions:
pull-requests: write

on:
pull_request:
types:
- opened
- edited
- synchronize

jobs:
validate-pr:
runs-on: ubuntu-latest
steps:
- name: Pull Request Title is Conventional
id: lint_pr_title
uses: amannn/action-semantic-pull-request@v5
with:
# Recommended Prefixes from https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/README.md#type-enum
types: |
build
chore
ci
docs
feat
fix
perf
refactor
revert
security
style
test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: failure()
name: Add PR comment if failed
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
message: |
Thank you for your contribution! We require all PR titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
Please update your PR title with the appropriate type and we'll try again!
```
${{ steps.lint_pr_title.outputs.error_message}}
```
- if: success()
name: Remove PR comment if valid
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true

0 comments on commit 9a05e0b

Please sign in to comment.