-
Notifications
You must be signed in to change notification settings - Fork 3.4k
48 lines (39 loc) · 1.15 KB
/
deploy.yml
File metadata and controls
48 lines (39 loc) · 1.15 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
name: Build and Release
on:
push:
branches: [main]
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build
- name: Zip build
run: cd dist/angular-conduit/browser && zip -r ../../../build.zip .
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: build-${{ github.run_number }}
files: build.zip
- name: Cleanup old releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
releases=$(gh release list --json tagName,createdAt --limit 100)
cutoff=$(date -d '7 days ago' -Iseconds)
echo "$releases" | jq -r '
to_entries
| .[]
| select(.key >= 5)
| select(.value.createdAt < "'"$cutoff"'")
| .value.tagName
' | while read -r tag; do
echo "Deleting release: $tag"
gh release delete "$tag" --cleanup-tag -y
done