-
Notifications
You must be signed in to change notification settings - Fork 2
98 lines (84 loc) · 2.59 KB
/
pages-release.yml
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
name: Deploy Botkube plugins to GitHub Pages
on:
push:
tags:
- "*"
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
- name: Build plugins binaries
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: build --rm-dist
- name: Generate plugins index.yaml
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "https://${{github.repository_owner}}.github.io/${{ github.event.repository.name }}"
run: |
go run github.com/kubeshop/botkube/hack -binaries-path "./dist"
- name: Release description
env:
PLUGIN_DOWNLOAD_URL_BASE_PATH: "https://${{github.repository_owner}}.github.io/${{ github.event.repository.name }}"
run: |
cat << EOF > README.md
Botkube Plugins **${GITHUB_REF#refs/tags/}** version are now available! :rocket:
To use plugins from this release, configure Botkube with:
EOF
cat << 'EOF' >> README.md
```yaml
plugins:
repositories:
EOF
cat << EOF >> README.md
${{ github.event.repository.name }}:
url: ${PLUGIN_DOWNLOAD_URL_BASE_PATH}/plugins-index.yaml
EOF
cat << 'EOF' >> README.md
```
EOF
- name: Render Markdown
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/markdown \
-f text="$(cat ./README.md)" > index.html
- name: Publish GitHub release
run: |
mkdir public
mv dist/executor_* public/
mv dist/source_* public/
mv plugins-index.yaml public/
mv index.html public/
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: public
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1