forked from anomalyco/sst
-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (111 loc) · 3.61 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (111 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: release
on:
workflow_dispatch:
push:
tags:
- "*"
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
id-token: write
contents: write
packages: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch tags
run: git fetch --force --tags
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ">=1.23.2"
cache: true
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download Go modules
run: go mod download
- name: Install dependencies
run: bun i --frozen-lockfile
- name: TypeScript check
run: cd platform && bun tsc --noEmit
- name: Build platform
run: ./platform/scripts/build
env:
DOCKER_PUSH: true
- name: Setup uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Run Go tests
run: go test -vet=all ./...
- name: Release CLI
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
- name: Release JS SDK
run: |
cd sdk/js
bun run release
- name: Authenticate crates.io
id: crates-auth
uses: rust-lang/crates-io-auth-action@v1
- name: Release Rust SDK
run: |
VERSION=$(jq -r .version dist/metadata.json)
cd sdk/rust
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-auth.outputs.token }}
- name: Build Python SDK
run: |
VERSION=$(jq -r .version dist/metadata.json)
cd sdk/python
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
uv build
- name: Publish Python SDK
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: sdk/python/dist/
- name: Announce on Discord
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
TAG: ${{ github.ref_name }}
run: |
RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/$TAG"
NOTES=$(gh release view "$TAG" --json body --jq .body \
| sed -E "s|\(#([0-9]+)\)|([#\1](https://github.com/${{ github.repository }}/pull/\1))|g" \
| sed -E 's|^\* \[[a-f0-9]+\]\([^)]+\): ||' \
| sed '/^## Changelog$/d' \
| sed -E 's|^(.+)$|- \1|')
CONTENT=$(printf '🏷️ [**Release - %s**](%s)\n%s' "$TAG" "$RELEASE_URL" "$NOTES")
PAYLOAD=$(jq -n --arg c "$CONTENT" '{content:$c, flags:4}')
curl -fsS -X POST -H "Content-Type: application/json" \
-d "$PAYLOAD" "$DISCORD_WEBHOOK_URL"