Skip to content

Commit

Permalink
feat: add release management automation
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHalat committed Sep 11, 2024
1 parent 26faa54 commit 99d5d71
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## PR Summary

Include a summary of the changes and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

**Change**:
- [ ] Feature
- [ ] Bug Fix
- [ ] Refactor
- [ ] Documentation changes
- [ ] Other (provide details):

**Version**:
- [ ] Major (breaking changes that require updates in multiple areas)
- [ ] Minor (new features or enhancements that are backward-compatible)
- [ ] Patch (bug fixes or small updates that do not alter any existing features)

### Control Verification

Include a video or gif of the control in action, if applicable.

### Additional Notes

Add any additional notes or comments that may be helpful for reviewers or stakeholders.
55 changes: 55 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
autolabeler:
- label: 'patch'
body:
- '/\[x] Patch/gm'
- label: 'minor'
body:
- '/\[x] Minor/gm'
- label: 'major'
body:
- '/\[x] Major/gm'
- label: 'bugfix'
body:
- '/\[x] Bug Fix/gm'
- label: 'documentation'
body:
- '/\[x] Documentation/gm'
- label: 'feature'
body:
- '/\[x] Feature/gm'
- label: 'enhancement'
body:
- '/\[x] New Component/gm'

version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch

name-template: 'v$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: 'Maintenance'
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
## Changes
$CHANGES
66 changes: 66 additions & 0 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2023 (Unpublished) Verto Inc.

name: Create npm registry release

on:
push:
tags:
- 'v*.*.*'

jobs:
bump-package-json-release:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.RELEASE_MANAGER_APP_ID }}
private-key: ${{ secrets.RELEASE_MANAGER_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
ref: main
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x
registry-url: "https://npm.pkg.github.com"
env:
NODE_AUTH_TOKEN: ${{ github.token }}

- name: Set tag
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Update package.json version
run: npm pkg set 'version'="$RELEASE_VERSION"
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}

- name: Setup Git credentials
run: |
git config --global user.name "Astral Release Bot"
git config --global user.email "astral-release@verto.ca"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit and push
run: |
git add package.json
git commit -m "Bump version to $RELEASE_VERSION"
git push
git tag -fa "$RELEASE_VERSION" -m "Bump version to $RELEASE_VERSION"
git push origin --tags --force
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}

- name: Run yarn
run: |
yarn
- name: Publish release
run: |
yarn publish
env:
NODE_AUTH_TOKEN: ${{ github.token }}
17 changes: 17 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 (Unpublished) Verto Inc.

name: Check PR labels

on:
pull_request:
types: [opened, labeled, unlabeled]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: jesusvasquez333/verify-pr-label-action@v1.4.0
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
valid-labels: 'major, minor, patch'
invalid-labels: 'hold'
24 changes: 24 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
branches:
- main

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 99d5d71

Please sign in to comment.