forked from treeverse/lakeFS
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (121 loc) · 4.31 KB
/
docs.yaml
File metadata and controls
130 lines (121 loc) · 4.31 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
name: docs
on:
push:
branches:
- master
paths:
- "docs/**"
- ".github/workflows/docs.yaml"
- ".github/workflows/docs-*.yaml"
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g., v1.2)"
required: true
type: string
set_latest:
description: "Set this version as latest"
required: false
default: false
type: boolean
jobs:
deploy:
name: Deploy Documentation
runs-on: ubuntu-latest
steps:
- name: Check-out
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
working-directory: docs
run: pip install -r requirements-docs.txt
- name: Checkout the documentation repository
uses: actions/checkout@v6
with:
repository: treeverse/docs-lakeFS
fetch-depth: 1
token: ${{ secrets.PERSONAL_TOKEN }}
path: docs/docs-repo
- name: Configure Git
working-directory: docs/docs-repo
run: |
git config --global user.name "treeverser"
git config --global user.email "treeverser@treeverse.io"
- name: Set deployment variables
id: setvars
shell: bash
run: |
VERSION="dev"
ALIASES=""
case "${{ github.event_name }}" in
release)
TAG="${{ github.event.release.tag_name }}"
if [[ "$TAG" =~ ^v?([0-9]+)\.([0-9]+) ]]; then
VERSION="v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
ALIASES="--update-aliases latest"
else
echo "::error::Could not extract v<major>.<minor> from tag '$TAG'. Aborting deployment."
exit 1
fi
;;
workflow_dispatch)
INPUT_VERSION="${{ github.event.inputs.version }}"
if [[ "$INPUT_VERSION" =~ ^v?([0-9]+)\.([0-9]+) ]]; then
VERSION="v${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
else
echo "::error::Could not extract v<major>.<minor> from input version '$INPUT_VERSION'. Aborting deployment."
exit 1
fi
if [[ "${{ github.event.inputs.set_latest }}" == "true" ]]; then
ALIASES="--update-aliases latest"
fi
;;
push)
VERSION="dev"
ALIASES=""
;;
esac
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "ALIASES=$ALIASES" >> $GITHUB_OUTPUT
- name: Deploy documentation
working-directory: docs/docs-repo
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
run: |
mike deploy --config-file ../mkdocs.yml --branch main --push "${{ steps.setvars.outputs.VERSION }}" ${{ steps.setvars.outputs.ALIASES }}
- name: Notify Slack on failure
if: failure() && github.event_name != 'workflow_dispatch'
uses: slackapi/slack-github-action@v2
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"text": "Documentation deployment failed",
"blocks": [
{
"type": "header", "text": { "type": "plain_text", "text": "📚 Documentation Deployment Failed" }
},
{
"type": "section", "fields": [
{ "type": "mrkdwn", "text": "*Repository:*\n${{ github.repository }}" },
{ "type": "mrkdwn", "text": "*Branch:*\n${{ github.ref_name }}" },
{ "type": "mrkdwn", "text": "*Version:*\n${{ steps.setvars.outputs.VERSION }}" },
{ "type": "mrkdwn", "text": "*Triggered by:*\n${{ github.actor }}" }
]
},
{
"type": "actions",
"elements": [
{ "type": "button", "text": { "type": "plain_text", "text": "View Run" }, "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" }
]
}
]
}