Skip to content

Commit 27b7af5

Browse files
committed
build: add the release task & workflow
1 parent c2d9b4a commit 27b7af5

File tree

2 files changed

+117
-1
lines changed

2 files changed

+117
-1
lines changed

.github/workflows/release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release (e.g., v1.2.3)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
release:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup mise
24+
uses: jdx/mise-action@v2
25+
26+
- name: Run release task
27+
run: mise run release -- ${{ inputs.version }}
28+
29+
- name: Create GitHub Release
30+
uses: actions/create-release@v1
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
tag_name: ${{ inputs.version }}
35+
release_name: Release ${{ inputs.version }}
36+
body: |
37+
## Changes
38+
39+
See [CHANGELOG.md](https://github.com/cdviz-dev/send-cdevents/blob/main/CHANGELOG.md) for details.
40+
41+
## Usage
42+
43+
```yaml
44+
- name: Send CDEvent
45+
uses: cdviz-dev/send-cdevents@${{ inputs.version }}
46+
with:
47+
data: |
48+
{
49+
"context": {
50+
"version": "0.4.1",
51+
"source": "github-actions",
52+
"type": "dev.cdevents.taskrun.started.0.2.0"
53+
},
54+
"subject": {
55+
"id": "${{ github.run_id }}",
56+
"type": "taskRun",
57+
"content": {
58+
"taskName": "ci-build"
59+
}
60+
}
61+
}
62+
url: "https://your-webhook-endpoint.com/cdevents"
63+
```
64+
draft: false
65+
prerelease: false

.mise.toml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,55 @@ run = [
1818

1919
[tasks.ci]
2020
description = "Run all CI checks locally"
21-
alias = "check"
21+
alias = "check"
22+
23+
[tasks.release]
24+
description = "Create a new release with version tag (usage: mise run release -- v1.2.3)"
25+
depends = ["check"]
26+
run = '''
27+
if [ -z "$1" ]; then
28+
echo 'Error: Please provide version (e.g., mise run release -- v1.2.3)'
29+
exit 1
30+
fi
31+
32+
VERSION="$1"
33+
MAJOR_VERSION=$(echo $VERSION | cut -d. -f1)
34+
35+
echo "=== Creating GitHub Action release ==="
36+
echo "Version: $VERSION (major: $MAJOR_VERSION)"
37+
38+
# Ensure we're on main branch and up to date
39+
git checkout main
40+
git pull origin main
41+
42+
# Create and push version tag
43+
echo "Creating tag: $VERSION"
44+
git tag -a "$VERSION" -m "Release $VERSION"
45+
git push origin "$VERSION"
46+
47+
# Update major version tag (e.g., v1)
48+
echo "Updating major version tag: $MAJOR_VERSION"
49+
git tag -f -a "$MAJOR_VERSION" -m "Release $MAJOR_VERSION (latest: $VERSION)"
50+
git push origin "$MAJOR_VERSION" --force
51+
52+
echo "=== Release completed! ==="
53+
echo "✅ Created version tag: $VERSION"
54+
echo "✅ Updated major tag: $MAJOR_VERSION"
55+
echo "📦 GitHub Marketplace will auto-update from the major version tag"
56+
echo "🔗 Create release notes at: https://github.com/cdviz-dev/send-cdevents/releases/new?tag=$VERSION"
57+
'''
58+
59+
[tasks.release-check]
60+
description = "Check current release status and tags"
61+
depends = ["check"]
62+
run = '''
63+
echo "=== Current Release Status ==="
64+
echo "Latest tags:"
65+
git tag --sort=-version:refname | head -5
66+
67+
echo "Current branch:"
68+
git branch --show-current
69+
70+
echo "Uncommitted changes:"
71+
git status --porcelain || echo "Working tree clean"
72+
'''

0 commit comments

Comments
 (0)