-
Notifications
You must be signed in to change notification settings - Fork 11
81 lines (70 loc) · 3.24 KB
/
Copy pathdev-release.yml
File metadata and controls
81 lines (70 loc) · 3.24 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: Dev Release
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ${{ github.repository_owner == 'paritytech' && 'parity-default' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.2.x"
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: pnpm install
- name: Compile CLI binaries
run: |
bun build --compile --target=bun-linux-x64 src/index.ts --outfile dot-linux-x64
bun build --compile --target=bun-linux-arm64 src/index.ts --outfile dot-linux-arm64
bun build --compile --target=bun-darwin-x64 src/index.ts --outfile dot-darwin-x64
bun build --compile --target=bun-darwin-arm64 src/index.ts --outfile dot-darwin-arm64
- name: Ensure gh CLI
run: type gh >/dev/null 2>&1 || (sudo apt-get update -qq && sudo apt-get install -y gh)
- name: Delete previous dev release
run: gh release delete "dev/${{ github.head_ref }}" --cleanup-tag -y 2>/dev/null || true
env:
GH_TOKEN: ${{ github.token }}
- name: Create dev release
uses: softprops/action-gh-release@v2
with:
tag_name: dev/${{ github.head_ref }}
name: "Dev: ${{ github.head_ref }}"
prerelease: true
make_latest: false
files: |
dot-linux-x64
dot-linux-arm64
dot-darwin-x64
dot-darwin-arm64
body: |
Dev build from `${{ github.head_ref }}`.
```
curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/${{ github.head_ref }} bash
```
- name: Comment install command on PR
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
BRANCH: ${{ github.head_ref }}
run: |
MARKER="<!-- dev-release -->"
BODY="${MARKER}
**Dev build ready** — try this branch:
\`\`\`
curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/${BRANCH} bash
\`\`\`"
# Find existing comment by marker, update or create
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${PR}/comments --jq ".[] | select(.body | startswith(\"${MARKER}\")) | .id" | head -1)
if [ -n "$COMMENT_ID" ]; then
gh api repos/${{ github.repository }}/issues/comments/${COMMENT_ID} -X PATCH -f body="$BODY"
else
gh pr comment "$PR" --body "$BODY"
fi