Skip to content

Commit 79d4a02

Browse files
authored
initial releaes
1 parent 04ac104 commit 79d4a02

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

.github/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .github/release.yml
2+
# see https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes
3+
4+
changelog:
5+
exclude:
6+
labels:
7+
- ignore-for-release
8+
authors:
9+
- octocat
10+
- github-actions
11+
categories:
12+
- title: Breaking Changes 🛠
13+
labels:
14+
- Semver-Major
15+
- breaking-change
16+
- title: Exciting New Features 🎉
17+
labels:
18+
- Semver-Minor
19+
- enhancement
20+
- title: Other Changes
21+
labels:
22+
- "*"

.github/workflows/release.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release (Semver from VERSION)
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- VERSION
9+
- .github/workflows/release.yaml
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: true
23+
24+
- name: Fetch tags
25+
run: git fetch --force --tags --prune
26+
27+
- name: Tag and release from VERSION
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
run: |
31+
set -euo pipefail
32+
33+
VERSION="$(tr -d ' \t\r\n' < VERSION)"
34+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
35+
echo "VERSION must be MAJOR.MINOR.PATCH, got: '$VERSION'"
36+
exit 1
37+
fi
38+
TAG="v${VERSION}"
39+
40+
# No-op if the tag already exists (safe reruns)
41+
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null || \
42+
git ls-remote --exit-code --tags origin "${TAG}" >/dev/null 2>&1; then
43+
echo "Tag ${TAG} already exists. Nothing to do."
44+
exit 0
45+
fi
46+
47+
git config user.name "${GITHUB_ACTOR}"
48+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
49+
50+
git tag -a "${TAG}" -m "Release ${TAG}"
51+
git push origin "refs/tags/${TAG}"
52+
53+
# Create GitHub release with auto-generated notes
54+
gh release create "${TAG}" --generate-notes --latest

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

0 commit comments

Comments
 (0)