-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (92 loc) · 3.61 KB
/
github-release-workflow.yml
File metadata and controls
104 lines (92 loc) · 3.61 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# ------------------------------------------------------------------------------
# GitHub Release Workflow
#
# This workflow creates GitHub Releases independently of Docker builds.
# It is triggered automatically by version-monitor dispatches or manually by
# maintainers who provide an explicit version.
# ------------------------------------------------------------------------------
name: GitHub Release Workflow
on:
repository_dispatch:
types: [version-monitor-release]
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.2.3)'
required: true
type: string
permissions:
contents: write # Required for creating GitHub Releases
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.resolve-version.outputs.version }}
trigger_source: ${{ steps.resolve-version.outputs.source }}
release_url: ${{ steps.release.outputs.release_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Resolve release version
id: resolve-version
shell: bash
run: |
EVENT_NAME="${{ github.event_name }}"
VERSION=""
SOURCE=""
case "$EVENT_NAME" in
repository_dispatch)
VERSION="${{ github.event.client_payload.version }}"
SOURCE="repository_dispatch"
;;
workflow_dispatch)
VERSION="${{ inputs.version }}"
SOURCE="workflow_dispatch"
;;
*)
echo "Error: Unsupported event '$EVENT_NAME'"
exit 1
;;
esac
if [ -z "$VERSION" ]; then
echo "Error: version is required when triggered by $SOURCE"
exit 1
fi
echo "Resolved version from $SOURCE: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "source=$SOURCE" >> "$GITHUB_OUTPUT"
- name: Run GitHub Release
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}
NUGEX_ReleaseVersion: ${{ steps.resolve-version.outputs.version }}
NUGEX_AzureBlobSasUrl: ${{ secrets.AZURE_BLOB_SAS_URL }}
run: |
./build.sh GitHubRelease
- name: Release summary
shell: bash
run: |
echo "## GitHub Release Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- **Version**: ${{ steps.resolve-version.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
echo "- **Trigger Source**: ${{ steps.resolve-version.outputs.source }}" >> "$GITHUB_STEP_SUMMARY"
echo "- **Workflow Run**: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_STEP_SUMMARY"
- name: Send Feishu Notification
id: feishu-notify
uses: HagiCode-org/haginotifier@v1
if: always()
with:
msg_type: 'interactive'
title: 'GitHub Release 创建完成'
message: |
**版本**: ${{ steps.resolve-version.outputs.version }}
**触发来源**: ${{ steps.resolve-version.outputs.source }}
**状态**: Release 创建完成
**触发者**: ${{ github.actor }}
**时间**: ${{ github.event.repository.updated_at }}
**链接**:
• Workflow Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}