-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.85 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (68 loc) · 2.85 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
name: Release
on:
workflow_run:
workflows:
- CI
types:
- completed
permissions:
contents: write
pull-requests: read
jobs:
check-and-release:
runs-on: ubuntu-latest
if:
${{ github.event.workflow_run.head_branch == 'release' && github.event.workflow_run.conclusion
== 'success' }}
steps:
- name: Log trigger information
run:
'echo "Triggered by workflow: ${{ github.event.workflow_run.name }}"
echo "Workflow status: ${{ github.event.workflow_run.conclusion }}"
echo "Branch: ${{ github.event.workflow_run.head_branch }}"
echo "Commit SHA: ${{ github.event.workflow_run.head_sha }}"
'
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Read VERSION
id: get_version
run: 'VERSION=$(cat VERSION)
echo "Creating release for version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
'
- name: Get Release Details
id: release_details
uses: actions/github-script@v7
with:
script:
"const commit_sha = \"${{ github.event.workflow_run.head_sha }}\"\
;\nconst { owner, repo } = context.repo;\n\n// Try to find a PR associated\
\ with this commit\nconst prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({\n\
\ owner,\n repo,\n commit_sha,\n});\n\nlet title = \"\";\nlet body\
\ = \"\";\n\nif (prs.data.length > 0) {\n const pr = prs.data[0];\n \
\ title = pr.title;\n body = pr.body || \"\";\n console.log(`Found PR\
\ #${pr.number}: ${title}`);\n} else {\n // Fallback to commit message\
\ if no PR found\n const commit = await github.rest.repos.getCommit({\n\
\ owner,\n repo,\n ref: commit_sha,\n });\n title = commit.data.commit.message.split('\\\
n')[0];\n body = commit.data.commit.message;\n console.log(`No PR found.\
\ Using commit message: ${title}`);\n}\n\ncore.setOutput('title', title);\n\
core.setOutput('body', body);\n"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION }}
name: Release v${{ env.VERSION }}
body: "## ${{ steps.release_details.outputs.title }}
${{ steps.release_details.outputs.body }}
### Build Artifacts
You can find the compilation artifact downloads for all required platforms
in the respective CI action execution artifacts.
"
target_commitish: ${{ github.event.workflow_run.head_sha }}
generate_release_notes: false
draft: false
prerelease: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"