-
Notifications
You must be signed in to change notification settings - Fork 45
81 lines (69 loc) · 2.71 KB
/
docs.yml
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
name: Deploy docs
on:
push:
branches: [develop]
jobs:
docs:
permissions:
contents: write
id-token: write
runs-on: [compile-gke]
container:
image: mangatasolutions/node-builder:multi-nightly-2023-05-22
env:
JOB_CACHE_PREFIX: node-docs-cache-1
CACHE_ARCHIVE_NAME: cache_archive.tar.zst
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
id: auth
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- uses: google-github-actions/setup-gcloud@v2
- name: Download cargo build cache
id: cache
run: |
set -x
CACHE_KEY="${{ env.JOB_CACHE_PREFIX }}-${{ hashFiles('**/Cargo.lock') }}"
ARCHIVE_NAME="${{ env.CACHE_ARCHIVE_NAME }}"
CACHE_FOUND=false
if gcloud storage cp "gs://mangata-node-ci-cache/$CACHE_KEY/$ARCHIVE_NAME" - | zstd -d | tar -xf - -C / ; then
CACHE_FOUND=true
fi
echo "cache_found=$CACHE_FOUND" >> $GITHUB_OUTPUT
echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
- uses: mozilla-actions/[email protected]
- run: |
echo "SCCACHE_GCS_BUCKET=mangata-node-ci-cache" >> $GITHUB_ENV
echo "SCCACHE_GCS_RW_MODE=READ_WRITE" >> $GITHUB_ENV
echo "SCCACHE_GCS_KEY_PREFIX=${{ env.JOB_CACHE_PREFIX }}" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV
- name: Build docs
run: cargo doc
- name: Deploy to GCP
uses: google-github-actions/[email protected]
with:
path: ./target/doc/
destination: mangata-docs-node
parent: false
concurrency: 50
process_gcloudignore: false
- name: Upload cargo build cache
shell: bash
run: |
set -x
CACHE_KEY="${{ steps.cache.outputs.cache_key }}"
ARCHIVE_NAME="${{ env.CACHE_ARCHIVE_NAME }}"
CACHE_PATHS=(
"./target"
"/usr/local/cargo/bin/"
"/usr/local/cargo/registry/index/"
"/usr/local/cargo/registry/cache/"
"/usr/local/cargo/git/db/"
)
SECONDS=0; tar -cf - "${CACHE_PATHS[@]}" | zstd -T0 -5 > "$ARCHIVE_NAME"
echo "Compression completed in $SECONDS seconds" && echo "Archive size: $(du -h "$ARCHIVE_NAME" | cut -f1)"
SECONDS=0; gcloud storage cp "$ARCHIVE_NAME" "gs://mangata-node-ci-cache/$CACHE_KEY/$ARCHIVE_NAME"
echo "Upload completed in $SECONDS seconds"