-
-
Notifications
You must be signed in to change notification settings - Fork 19
58 lines (51 loc) · 1.58 KB
/
deploy-docs.yaml
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
---
name: Deploy docs
on:
workflow_dispatch: {}
release:
types:
- published
push:
branches:
- master
- main
paths:
- docs/**
permissions:
contents: write
jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v30
- uses: workflow/nix-shell-action@v3.4.0
with:
working-directory: docs
flakes-from-devshell: true
script: |
git config user.name github-actions
git config user.email github-actions@github.com
echo "$GITHUB_REF_NAME"
## Deploy to dev on push events and exit
if [ "$GITHUB_REF_NAME" == "master" ] || [ "$GITHUB_REF_NAME" == "main" ]; then
mike deploy develop --push --allow-empty
exit 0
fi
mike_versions=$(mike list -j)
## Retitle all versions back to its original
for item in $(echo "$mike_versions" | jq -c '.[]'); do
title=$(echo "$item" | jq -r '.title')
version=$(echo "$item" | jq -r '.version')
if [ "$title" == "latest" ]; then
mike retitle "$version" "$version"
fi
done
major="${GITHUB_REF_NAME%%.*}"
minor="${GITHUB_REF_NAME#*.}"
minor="${minor%%.*}"
maj_min="$major"."$minor"
mike deploy "$maj_min" latest --title latest --update-aliases --allow-empty
mike set-default latest --push --allow-empty