-
Notifications
You must be signed in to change notification settings - Fork 23
86 lines (77 loc) · 3.11 KB
/
provider-updoc.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
82
83
84
85
86
name: Updoc
on:
workflow_call:
inputs:
providers:
description: 'Family provider names for which to publish the docs, e.g., "monolith config". The provider names should be space-delimited.'
default: 'monolith'
required: false
type: string
go-version:
description: 'Go version to use if building needs to be done'
default: '1.20'
required: false
type: string
secrets:
UPBOUND_CI_PROD_BUCKET_SA:
required: true
env:
UPTEST_VERSION: "83bd901"
jobs:
publish-docs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
submodules: true
- name: Setup Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
with:
go-version: ${{ inputs.go-version }}
- name: Find Go Caches
id: go
run: |
echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT
echo "modcache=$(make go.mod.cachedir)" >> $GITHUB_OUTPUT
- name: Cache the Go Build Cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-updoc-artifacts-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-updoc-artifacts-
- name: Cache Go Dependencies
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
path: ${{ steps.go.outputs.modcache }}
key: ${{ runner.os }}-updoc-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-updoc-pkg-
- name: Create Service Account File
env:
GAC: ${{ secrets.UPBOUND_CI_PROD_BUCKET_SA }}
run: |
echo "${GAC}" > sa.json
- name: Upload Docs
env:
GOOGLE_APPLICATION_CREDENTIALS: sa.json
VER_MAJOR_MINOR: v${GITHUB_REF#"refs/heads/release-"}
SUBPACKAGES: ${{ inputs.providers }}
run: |
if [[ "${GITHUB_REF##*/}" == release-* ]]; then
for s in $SUBPACKAGES; do
PROVIDER_PACKAGE_NAME="provider-${GITHUB_REPOSITORY##*-}-${s}"
DOCS_DIR="./docs/family"
if [ $s == 'monolith' ]; then
PROVIDER_PACKAGE_NAME="provider-${GITHUB_REPOSITORY##*-}"
DOCS_DIR="./docs/monolith"
elif [ $s == 'config' ]; then
PROVIDER_PACKAGE_NAME="provider-family-${GITHUB_REPOSITORY##*-}"
DOCS_DIR="./docs/family"
fi
echo "Publishing Docs for ${PROVIDER_PACKAGE_NAME}, ${{ env.VER_MAJOR_MINOR }} from $DOCS_DIR"
go run github.com/upbound/uptest/cmd/updoc@${{ env.UPTEST_VERSION }} upload --docs-dir="${DOCS_DIR}" --name="${PROVIDER_PACKAGE_NAME}" --version=${{ env.VER_MAJOR_MINOR }} --bucket-name=bucket-marketplace-docs-production --cdn-domain=https://user-content.upbound.io
done
else
echo "This job can only be run on release branches"
exit 1
fi