Skip to content

Commit 042f1a4

Browse files
Add release workflow (#564)
1 parent 8c91a99 commit 042f1a4

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

.github/release_config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# see https://github.com/release-drafter/release-drafter
2+
name-template: 'v$RESOLVED_VERSION 🌈'
3+
tag-template: 'v$RESOLVED_VERSION'
4+
categories:
5+
- title: '🚀 Features'
6+
labels:
7+
- 'feature'
8+
- 'enhancement'
9+
- title: '🐛 Bug Fixes'
10+
labels:
11+
- 'fix'
12+
- 'bugfix'
13+
- 'bug'
14+
- title: '🧰 Maintenance'
15+
label: 'chore'
16+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
17+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
18+
version-resolver:
19+
major:
20+
labels:
21+
- 'major'
22+
minor:
23+
labels:
24+
- 'minor'
25+
patch:
26+
labels:
27+
- 'patch'
28+
default: patch
29+
template: |
30+
## Changes
31+
32+
$CHANGES
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- master
8+
# # pull_request event is required only for autolabeler
9+
# pull_request:
10+
# # Only following types are handled by the action, but one can default to all as well
11+
# types: all # [opened, reopened, synchronize]
12+
# # pull_request_target event is required for autolabeler to support PRs from forks
13+
# # pull_request_target:
14+
# # types: [opened, reopened, synchronize]
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
update_release_draft:
21+
permissions:
22+
# write permission is required to create a github release
23+
contents: write
24+
# write permission is required for autolabeler
25+
# otherwise, read permission is required at least
26+
pull-requests: write
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Check out the repository
30+
uses: actions/checkout@v3
31+
with:
32+
fetch-depth: 2
33+
34+
- name: Detect new version
35+
id: check-version
36+
#if: steps.check-parent-commit.outputs.sha
37+
uses: salsify/[email protected]
38+
with:
39+
create-tag: false
40+
version-command: |
41+
grep -Eo '^__version__ = \"(.*)\"$' micro_sam/__version__.py | cut -d\" -f2
42+
43+
- name: Push tag
44+
id: tag-version
45+
if: steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
46+
uses: mathieudutour/[email protected]
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
custom_tag: ${{ steps.check-version.outputs.current-version }}
50+
51+
# Drafts your next Release notes as Pull Requests are merged into "master"
52+
- name: Publish the release notes
53+
uses: release-drafter/[email protected]
54+
with:
55+
config-name: release_config.yaml
56+
publish: "${{ steps.tag-version.outputs.new_tag != '' }}"
57+
tag: "${{ steps.tag-version.outputs.new_tag }}"
58+
env:
59+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)