Skip to content

Commit 1a983bf

Browse files
release: github action #108
2 parents def6595 + ce597ed commit 1a983bf

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/docs-to-vector.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Docs to Vector
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Prepare Payload
14+
id: payload
15+
run: |
16+
payload=$(jq -n \
17+
--arg current_commit_id "${{ github.sha }}" \
18+
--arg branch_name "${{ github.ref_name }}" \
19+
--arg repo_name "${{ github.event.repository.name }}" \
20+
'{
21+
current_commit_id: $current_commit_id,
22+
branch_name: $branch_name,
23+
repo_name: $repo_name,
24+
}')
25+
26+
echo "$payload" > /tmp/payload.json
27+
28+
- name: Connect to company network
29+
uses: tailscale/github-action@v3
30+
with:
31+
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
32+
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
33+
tags: tag:ci
34+
35+
- name: Call Webhook (Preview)
36+
run: |
37+
payload=$(cat /tmp/payload.json)
38+
sig=$(printf '%s' "$payload" | \
39+
openssl dgst -sha256 -hmac "${{ secrets.VECTOR_WEBHOOK_SECRET_PREVIEW }}" -binary | xxd -p -c 256)
40+
41+
curl -X POST \
42+
-H "Content-Type: application/json" \
43+
-H "X-Hub-Signature-256: sha256=$sig" \
44+
-d "$payload" \
45+
${{ secrets.VECTOR_WEBHOOK_URL_PREVIEW }}
46+
47+
- name: Call Webhook (Master)
48+
if: ${{ github.ref_name == 'master' }}
49+
run: |
50+
payload=$(cat /tmp/payload.json)
51+
sig=$(printf '%s' "$payload" | \
52+
openssl dgst -sha256 -hmac "${{ secrets.VECTOR_WEBHOOK_SECRET }}" -binary | xxd -p -c 256)
53+
54+
if [ "${{ secrets.VECTOR_WEBHOOK_URL }}" != "none" ]; then
55+
curl -X POST \
56+
-H "Content-Type: application/json" \
57+
-H "X-Hub-Signature-256: sha256=$sig" \
58+
-d "$payload" \
59+
${{ secrets.VECTOR_WEBHOOK_URL }}
60+
fi

0 commit comments

Comments
 (0)