-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (40 loc) · 1.62 KB
/
Copy pathrelease.yml
File metadata and controls
52 lines (40 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This workflow automates the release process when a draft release is created
# on GitHub. It uses Maven release plugin to manage versions and deploys to
# Maven Central
#
# Usage:
# 1. Create a new draft release in GitHub UI with tag format: vX.Y.Z
# (e.g., v1.2.0)
# - Select the target branch (typically main)
# 2. This workflow will automatically:
# - Use Maven release:prepare to update versions and create release commit
# - Use Maven release:perform to build and deploy artifacts to Maven Central
# - Create the tag to point to release commit
# - Push commits back to the originating branch
# - Publish the GitHub release (mark draft as non-draft)
name: Automated Release
on:
release:
types: [created] # Only fire when a release is created
permissions:
contents: write # Required to push commits, update tags and edit releases
jobs:
release:
# Only run for draft releases; ignore non-draft created events
if: github.event.release.draft
runs-on: ubuntu-latest
steps:
- name: Validate release tag format
id: validate_tag
run: |
TAG_NAME="${{ github.event.release.tag_name }}"
echo "Release tag: $TAG_NAME"
# Validate tag format (should be vX.Y.Z)
if [[ ! "$TAG_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid tag format. Expected format: vX.Y.Z (e.g., v1.2.0)"
exit 1
fi
# Remove 'v' prefix to get the version number
VERSION="${TAG_NAME#v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Extracted version: $VERSION"