Skip to content

Commit

Permalink
feat: add gh actions to create draft releases with new changes (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
inigomarquinez committed Oct 11, 2023
1 parent 60f567d commit 1e07d9b
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 107 deletions.
55 changes: 55 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# https://github.com/marketplace/actions/release-drafter#configuration

name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.

# https://github.com/release-drafter/release-drafter#version-resolver
# With the version-resolver option version number incrementing can be
# resolved automatically based on labels of individual pull requests.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'

# https://github.com/release-drafter/release-drafter#categorize-pull-requests
# With the categories option you can categorize pull requests in release
# notes using labels.
categories:
- title: '💥 Breaking changes'
labels:
- 'major'
- title: '🚀 New features'
labels:
- 'minor'
- title: '🧰 Others'
labels:
- 'patch'

# https://github.com/release-drafter/release-drafter#autolabeler
# You can add automatically a label into a pull request, with the autolabeler
# option. Available matchers are files (glob), branch (regex), title (regex)
# and body (regex). Matchers are evaluated independently; the label will be
# set if at least one of the matchers meets the criteria.
autolabeler:
- label: 'major'
title:
- '/^\S+!{1}:{1}\s{1}\S*/i'
- label: 'minor'
title:
- '/^feat:{1}\s{1}\S*/i'
- label: 'patch'
title:
- '/^(build|chore|ci|docs|fix|perf|refactor|revert|style|test):{1}\s{1}\S*/i'

template: |
## What’s Changed
$CHANGES
25 changes: 25 additions & 0 deletions .github/workflows/label-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Label checker

on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled

jobs:
check_labels:
name: Check for semver label
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- name: Label checker
uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: major,minor,patch
repo_token: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to npm

on:
release:
types:
- published

permissions:
contents: read

jobs:
npm-publish:
runs-on: ubuntu-latest

permissions:
id-token: write

steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

- name: Setup Node.js
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: npm ci --production

- name: Publish to npm
run: |
npm publish --provenance --ignore-scripts --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GUIDESMITHS }}
70 changes: 0 additions & 70 deletions .github/workflows/release-and-publish.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release drafter

on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
with:
egress-policy: audit
- uses: release-drafter/release-drafter@65c5fb495d1e69aa8c08a3317bc44ff8aabe9772 # v5.24.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 0 additions & 37 deletions .github/workflows/semantic-pull-request.yml

This file was deleted.

0 comments on commit 1e07d9b

Please sign in to comment.