-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (111 loc) · 4.49 KB
/
release.yml
File metadata and controls
127 lines (111 loc) · 4.49 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
id-token: write
attestations: write
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Build linux targets
run: |
VERSION=${GITHUB_REF_NAME#v}
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$VERSION -X main.commit=${{ github.sha }}" -o build/asylum-linux-amd64 ./cmd/asylum
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=$VERSION -X main.commit=${{ github.sha }}" -o build/asylum-linux-arm64 ./cmd/asylum
- uses: actions/upload-artifact@v4
with:
name: binaries-linux
path: build/asylum-*
build-darwin:
uses: ./.github/workflows/build-sign-darwin.yml
with:
version: ${{ github.ref_name }}
commit: ${{ github.sha }}
secrets:
APPLE_CERTIFICATE_P12: ${{ secrets.APPLE_CERTIFICATE_P12 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}
release:
runs-on: ubuntu-latest
needs: [build-linux, build-darwin]
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v4
with:
path: build
pattern: binaries-*
merge-multiple: true
- name: Generate checksums
run: cd build && sha256sum asylum-* > checksums.txt
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: 'build/asylum-*'
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
build/asylum-*
build/checksums.txt
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install mkdocs-material mike
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Deploy versioned docs
run: |
VERSION=${GITHUB_REF_NAME#v}
mike deploy "$VERSION" latest --update-aliases --push
mike set-default latest --push
notify:
needs: [release, docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Notify Rocket.Chat
env:
ROCKETCHAT_WEBHOOK_URL: ${{ secrets.ROCKETCHAT_WEBHOOK_URL }}
run: |
VERSION=${GITHUB_REF_NAME#v}
CHANGELOG=$(sed -n "/^## ${VERSION}/,/^## /{/^## ${VERSION}/d;/^## /d;p;}" CHANGELOG.md | sed '/^$/N;/^\n$/d')
# Summary is the text before the first ### section
SUMMARY=$(echo "$CHANGELOG" | sed -n '/^### /q;p' | sed '/^$/d')
ADDED=$(echo "$CHANGELOG" | sed -n '/^### Added/,/^### /{/^### Added/d;/^### /d;p;}' | sed '/^$/d')
CHANGED=$(echo "$CHANGELOG" | sed -n '/^### Changed/,/^### /{/^### Changed/d;/^### /d;p;}' | sed '/^$/d')
FIXED=$(echo "$CHANGELOG" | sed -n '/^### Fixed/,/^### /{/^### Fixed/d;/^### /d;p;}' | sed '/^$/d')
jq -n \
--arg version "$VERSION" \
--arg tag "${GITHUB_REF_NAME}" \
--arg summary "$SUMMARY" \
--arg added "$ADDED" \
--arg changed "$CHANGED" \
--arg fixed "$FIXED" \
'{
text: (":rocket: **Asylum " + $version + "** has been released\n\n" + (if ($summary | length) > 0 then $summary + "\n\n" else "" end) + "**Update:**\n```\nasylum self-update\n```\n\n[Documentation](https://asylum.inventage.ai/" + $version + "/) · [Release](https://github.com/inventage-ai/asylum/releases/tag/" + $tag + ")"),
attachments: [
(if ($added | length) > 0 then { title: "Added", text: $added, color: "#2ecc71" } else empty end),
(if ($changed | length) > 0 then { title: "Changed", text: $changed, color: "#f39c12" } else empty end),
(if ($fixed | length) > 0 then { title: "Fixed", text: $fixed, color: "#3498db" } else empty end)
]
}' | curl -sf -X POST "$ROCKETCHAT_WEBHOOK_URL" \
-H 'Content-Type: application/json' \
-d @-