-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (115 loc) · 4.26 KB
/
deploy-docs.yaml
File metadata and controls
128 lines (115 loc) · 4.26 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
name: Deploy docs to Cloudflare
on:
workflow_dispatch:
inputs:
debug_enabled:
description: "Run with tmate.io debugging enabled"
required: true
type: string
default: "false"
branch:
description: "Git branch or ref to checkout"
required: true
type: string
workflow_call:
inputs:
debug_enabled:
description: "Run with tmate.io debugging enabled"
type: string
default: "false"
branch:
description: "Git branch or ref to checkout"
required: true
type: string
defaults:
run:
shell: bash
permissions:
contents: read
deployments: write
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
# https://github.com/easimon/maximize-build-space/blob/v10/action.yml#L121-L137
- name: Maximize build space
run: |
echo "Available storage before removing unused software:"
sudo df -h
echo
sudo rm -rf /usr/local/lib/android
echo "Available storage after removing android:"
sudo df -h
echo
sudo rm -rf /opt/hostedtoolcache/CodeQL
echo "Available storage after removing codeql:"
sudo df -h
echo
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4.2.2
with:
ref: ${{ inputs.branch }}
- name: Install nix
uses: DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 # ratchet:DeterminateSystems/nix-installer-action@v20
with:
extra-conf: "system-features = nixos-test benchmark big-parallel kvm"
# - name: Install Nix
# uses: nixbuild/nix-quick-install-action@v33
# with:
# nix_conf: "system-features = nixos-test benchmark big-parallel kvm"
- name: Setup remote cache
# TODO: disable continue-on-error https://www.github.com/cachix/cachix-action/issues/200
uses: cachix/cachix-action@3ba601ff5bbb07c7220846facfa2cd81eeee15a1 # ratchet:cachix/cachix-action@master
continue-on-error: true
with:
name: "${{ vars.CACHIX_CACHE_NAME }}"
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
extraPullNames: nix-community,poetry2nix,celldynamics,pyproject-nix,sciexp
- name: Setup tmate debug session
uses: mxschmitt/action-tmate@e5c7151931ca95bad1c6f4190c730ecf8c7dde48 # ratchet:mxschmitt/action-tmate@v3
if: ${{ inputs.debug_enabled == 'true' }}
- name: Build docs
env:
SOPS_AGE_KEY: ${{ secrets.CI_AGE_KEY }}
run: |
df -h
nix develop --accept-flake-config -c just docs-build
df -h
- name: Upload docs
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # ratchet:actions/upload-artifact@v4
with:
name: docs-site
path: |
docs/_site
wrangler.jsonc
deploy-docs:
needs: build-docs
runs-on: ubuntu-latest
steps:
- name: Download docs
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # ratchet:actions/download-artifact@v4
with:
name: docs-site
- name: Site artifact tree
run: |
if command -v tree &> /dev/null; then
tree --du -alh
else
echo "tree command not found, skipping file tree display"
fi
- name: Deploy preview
id: deployment
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # ratchet:cloudflare/wrangler-action@v3
with:
wranglerVersion: "4.37.1"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload --preview-alias b-${{ inputs.branch }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Preview rollout command
env:
WRANGLER_OUTPUT: ${{ steps.deployment.outputs.command-output }}
run: |
WRANGLER_VERSION_ID=$(echo "$WRANGLER_OUTPUT" | grep -oP 'Version ID: \K[a-f0-9-]+')
echo "WRANGLER_VERSION_ID=$WRANGLER_VERSION_ID"
echo "bunx wrangler versions deploy ${WRANGLER_VERSION_ID}@100 --yes --dry-run"