-
Notifications
You must be signed in to change notification settings - Fork 66
74 lines (65 loc) · 2.37 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (65 loc) · 2.37 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
name: Release
on:
workflow_dispatch:
release:
types: [published]
jobs:
deploy:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
# Only 'hud' is published. The old 'hud-python' name is closed off by a
# final release that refuses to install and points at 'hud'; its source
# lives in hud-python/ and is published once, by hand.
- name: Build and publish 'hud' to PyPI
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
uv build
uv publish
deploy-docs:
if: ${{ always() && (github.event_name == 'workflow_dispatch' || (needs.deploy.result == 'success' && !github.event.release.prerelease)) }}
needs: deploy
runs-on: ubuntu-latest
timeout-minutes: 15
env:
MINTLIFY_API_KEY: ${{ secrets.MINTLIFY_API_KEY }}
MINTLIFY_PROJECT_ID: ${{ vars.MINTLIFY_PROJECT_ID }}
steps:
- name: Deploy docs to Mintlify
run: |
: "${MINTLIFY_API_KEY:?MINTLIFY_API_KEY is not configured}"
: "${MINTLIFY_PROJECT_ID:?MINTLIFY_PROJECT_ID is not configured}"
response=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.mintlify.com/v1/project/update/${MINTLIFY_PROJECT_ID}" \
--header "Authorization: Bearer ${MINTLIFY_API_KEY}")
status_id=$(jq -er '.statusId' <<< "$response")
for _ in {1..60}; do
response=$(curl --silent --show-error --fail-with-body \
--url "https://api.mintlify.com/v1/project/update-status/${status_id}" \
--header "Authorization: Bearer ${MINTLIFY_API_KEY}")
status=$(jq -er '.status' <<< "$response")
case "$status" in
success)
exit 0
;;
failure)
jq -r '.summary, (.logs[]? // empty)' <<< "$response"
exit 1
;;
queued|in_progress)
sleep 10
;;
*)
echo "Unknown Mintlify deployment status: $status"
exit 1
;;
esac
done
echo "Timed out waiting for Mintlify deployment $status_id."
exit 1