Skip to content

Commit a1e27ec

Browse files
committed
release action
1 parent 76b52b5 commit a1e27ec

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options
2+
changelog:
3+
exclude:
4+
labels:
5+
- ci
6+
- ignore-for-release
7+
authors:
8+
- github-actions
9+
- octocat
10+
categories:
11+
- title: Breaking Changes 🛠
12+
labels:
13+
- semver/major
14+
- breaking-change
15+
- title: New Features 🎉
16+
labels:
17+
- semver/minor
18+
- enhancement
19+
- title: Bug Fixes 🐛
20+
labels:
21+
- semver/patch
22+
- bug
23+
- title: Other Changes
24+
labels:
25+
- "*"

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
release_type:
6+
description: Type of release
7+
type: choice
8+
required: true
9+
options:
10+
- patch
11+
- minor
12+
- major
13+
14+
jobs:
15+
release:
16+
name: Release
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: Git checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Get latest release version
25+
id: get_current_version
26+
uses: actions/github-script@v7
27+
with:
28+
script: |
29+
const { data: { tag_name } } = await github.rest.repos.getLatestRelease({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo
32+
})
33+
return tag_name
34+
35+
- name: Bump version
36+
id: bump
37+
uses: Mobelux/bump-version-action@v1
38+
with:
39+
release-type: ${{ inputs.release_type }}
40+
version: ${{ steps.get_current_version.outputs.result }}
41+
42+
- name: Push tag
43+
uses: actions/github-script@v7
44+
with:
45+
script: |
46+
github.rest.git.createRef({
47+
owner: context.repo.owner,
48+
repo: context.repo.repo,
49+
ref: 'refs/tags/${{ steps.bump.outputs.version }}',
50+
sha: context.sha
51+
})
52+
53+
- name: Create release
54+
uses: actions/github-script@v7
55+
with:
56+
script: |
57+
github.rest.repos.createRelease({
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
tag_name: '${{ steps.bump.outputs.version }}',
61+
generate_release_notes: true,
62+
draft: false,
63+
prerelease: false
64+
})

0 commit comments

Comments
 (0)