Repository navigation
90 lines (71 loc) · 2.96 KB
/
Copy pathprerelease.yml
File metadata and controls
90 lines (71 loc) · 2.96 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
name: prerelease
on:
push:
branches: [v0.x, v1.x]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: prerelease-${{ github.ref_name }}
cancel-in-progress: true
jobs:
prerelease:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
RELEASE_TAG: ${{ github.ref_name == 'v0.x' && 'prerelease' || format('prerelease-{0}', github.ref_name) }}
RELEASE_TITLE: ${{ github.ref_name == 'v0.x' && 'prerelease' || format('prerelease ({0})', github.ref_name) }}
TARBALL_NAME: agentcore-cli-prerelease.tgz
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- run: bun install --frozen-lockfile --os="*" --cpu="*"
- name: Set prerelease version
run: |
VERSION="1.0.0-${GITHUB_SHA: -6}"
bun pm pkg set "version=$VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- run: bun run build
- name: Pack CLI
run: |
bun pm pack --destination "$RUNNER_TEMP" --ignore-scripts
tarball="$(find "$RUNNER_TEMP" -maxdepth 1 -type f -name 'aws-agentcore-*.tgz' -print -quit)"
test -f "$tarball"
mv "$tarball" "$RUNNER_TEMP/$TARBALL_NAME"
- run: bun run compile
- name: Write release notes
run: |
release_url="https://github.com/$GITHUB_REPOSITORY/releases/download/$RELEASE_TAG"
cat > "$RUNNER_TEMP/release-notes.md" <<EOF
Auto-generated prerelease from commit \`$GITHUB_SHA\` on \`$GITHUB_REF_NAME\`.
Version: \`$VERSION\`
## Download
### CLI tarball
[\`$TARBALL_NAME\`]($release_url/$TARBALL_NAME)
\`\`\`bash
npm i -g "$release_url/$TARBALL_NAME"
\`\`\`
### Standalone executables
| Platform | Download |
| --- | --- |
| macOS Intel | [agentcore-darwin-x64]($release_url/agentcore-darwin-x64) |
| macOS Apple Silicon | [agentcore-darwin-arm64]($release_url/agentcore-darwin-arm64) |
| Linux x64 | [agentcore-linux-x64]($release_url/agentcore-linux-x64) |
| Linux arm64 | [agentcore-linux-arm64]($release_url/agentcore-linux-arm64) |
| Windows x64 | [agentcore-windows-x64.exe]($release_url/agentcore-windows-x64.exe) |
| Windows arm64 | [agentcore-windows-arm64.exe]($release_url/agentcore-windows-arm64.exe) |
EOF
- name: Create or update prerelease
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release delete "$RELEASE_TAG" --yes --cleanup-tag 2>/dev/null || true
gh release create "$RELEASE_TAG" \
"$RUNNER_TEMP/$TARBALL_NAME" \
dist/bin/* \
--title "$RELEASE_TITLE" \
--notes-file "$RUNNER_TEMP/release-notes.md" \
--prerelease \
--target "$GITHUB_SHA"