1
1
name : PR Preview Release
2
2
3
3
on :
4
- workflow_run :
5
- workflows : ["PR Preview Build"]
6
- types :
7
- - completed
4
+ workflow_run :
5
+ workflows : ["PR Preview Build"]
6
+ types :
7
+ - completed
8
8
9
9
permissions :
10
- contents : write
11
- pull-requests : write
10
+ contents : write
11
+ pull-requests : write
12
12
13
13
jobs :
14
- release :
15
- name : Create Release
16
- runs-on : ubuntu-latest
17
- if : ${{ github.event.workflow_run.conclusion == 'success' }}
14
+ release :
15
+ name : Create Release
16
+ runs-on : ubuntu-latest
17
+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
18
18
19
- steps :
20
- - name : Download PR number
21
- uses : actions/download-artifact@v4
22
- with :
23
- name : pr-number
24
- github-token : ${{ secrets.GITHUB_TOKEN }}
25
- run-id : ${{ github.event.workflow_run.id }}
19
+ steps :
20
+ - name : Download PR number
21
+ uses : actions/download-artifact@v4
22
+ with :
23
+ name : pr-number
24
+ github-token : ${{ secrets.GITHUB_TOKEN }}
25
+ run-id : ${{ github.event.workflow_run.id }}
26
26
27
- - name : Read PR number
28
- id : pr
29
- run : echo "number=$(cat number)" >> $ GITHUB_OUTPUT
27
+ - name : Read PR number
28
+ id : pr
29
+ run : echo "number=$(cat number)" >> "${ GITHUB_OUTPUT}"
30
30
31
- - name : Download Build Artifacts
32
- uses : actions/download-artifact@v4
33
- with :
34
- name : agentapi-build-${{ steps.pr.outputs.number }}
35
- path : ./out
36
- github-token : ${{ secrets.GITHUB_TOKEN }}
37
- run-id : ${{ github.event.workflow_run.id }}
31
+ - name : Download Build Artifacts
32
+ uses : actions/download-artifact@v4
33
+ with :
34
+ name : agentapi-build-${{ steps.pr.outputs.number }}
35
+ path : ./out
36
+ github-token : ${{ secrets.GITHUB_TOKEN }}
37
+ run-id : ${{ github.event.workflow_run.id }}
38
38
39
+ - name : Create or Update PR Release
40
+ env :
41
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42
+ RELEASE_TAG : " agentapi_${{ steps.pr.outputs.number }}"
43
+ PR_NUMBER : ${{ steps.pr.outputs.number }}
39
44
40
- - name : Create or Update PR Release
41
- env :
42
- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
- RELEASE_TAG : ' agentapi_${{ steps.pr.outputs.number }}'
44
- PR_NUMBER : ${{ steps.pr.outputs.number }}
45
+ run : |
46
+ # Check if release exists
47
+ if gh release view "$RELEASE_TAG" --repo ${{ github.repository }} &>/dev/null; then
48
+ echo "Updating release $RELEASE_TAG"
49
+ gh release upload "$RELEASE_TAG" ./out/* --clobber --repo ${{ github.repository }}
50
+ else
51
+ echo "Creating release $RELEASE_TAG"
52
+ gh release create "$RELEASE_TAG" ./out/* \
53
+ --title "$RELEASE_TAG" \
54
+ --notes "Preview release for PR #${PR_NUMBER}" \
55
+ --repo ${{ github.repository }}
56
+ fi
45
57
46
- run : |
47
- # Check if release exists
48
- if gh release view "$RELEASE_TAG" --repo ${{ github.repository }} &>/dev/null; then
49
- echo "Updating release $RELEASE_TAG"
50
- gh release upload "$RELEASE_TAG" ./out/* --clobber --repo ${{ github.repository }}
51
- else
52
- echo "Creating release $RELEASE_TAG"
53
- gh release create "$RELEASE_TAG" ./out/* \
54
- --title "$RELEASE_TAG" \
55
- --notes "Preview release for PR #${PR_NUMBER}" \
56
- --repo ${{ github.repository }}
57
- fi
58
-
59
- - name : Comment on PR
60
- uses : actions/github-script@v7
61
- with :
62
- script : |
63
- const prNumber = ${{ steps.pr.outputs.number }};
64
- const releaseTag = `agentapi_${prNumber}`;
65
- github.rest.issues.createComment({
66
- issue_number: prNumber,
67
- owner: context.repo.owner,
68
- repo: context.repo.repo,
69
- body: `✅ Preview binaries are ready!\n\nTo test with modules: \`\`\`agentapi: ${prNumber}\`\`\` or download from: ${repoUrl}/releases/tag/${releaseTag}`
70
- });
58
+ - name : Comment on PR
59
+ uses : actions/github-script@v7
60
+ with :
61
+ script : |
62
+ const prNumber = ${{ steps.pr.outputs.number }};
63
+ const releaseTag = `agentapi_${prNumber}`;
64
+ github.rest.issues.createComment({
65
+ issue_number: prNumber,
66
+ owner: context.repo.owner,
67
+ repo: context.repo.repo,
68
+ body: `✅ Preview binaries are ready!\n\nTo test with modules: \`\`\`agentapi: ${prNumber}\`\`\` or download from: ${repoUrl}/releases/tag/${releaseTag}`
69
+ });
0 commit comments