Skip to content

Commit 9564350

Browse files
committed
Add 'Set up docs-builder' action
1 parent 739111d commit 9564350

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
this documentation was generated by https://github.com/reakaleek/gh-action-readme
3+
with the command `VERSION=main gh action-readme update`
4+
-->
5+
6+
# <!--name-->Set up docs-builder CLI<!--/name-->
7+
8+
<!--description-->
9+
Set up docs-builder CLI for use in actions
10+
<!--/description-->
11+
12+
## Inputs
13+
14+
<!--inputs-->
15+
| Name | Description | Required | Default |
16+
|----------------|----------------------------------------------|----------|-----------------------|
17+
| `version` | The docs-builder version to download and use | `false` | `latest` |
18+
| `github-token` | GitHub token | `true` | `${{ github.token }}` |
19+
<!--/inputs-->
20+
21+
## Outputs
22+
<!--outputs-->
23+
| Name | Description |
24+
|------|-------------|
25+
<!--/outputs-->
26+
27+
## Usage
28+
29+
<!--usage action="elastic/docs-builder/actions/setup-docs-builder" version="env:VERSION"-->
30+
```yaml
31+
32+
jobs:
33+
build:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Set up docs-builder
37+
uses: elastic/docs-builder/actions/setup-docs-builder@main
38+
version: 'latest'
39+
40+
- run: docs-builder --version
41+
```
42+
<!--/usage-->
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Set up docs-builder CLI
2+
3+
description: 'Set up docs-builder CLI for use in actions'
4+
5+
inputs:
6+
version:
7+
required: false
8+
default: 'latest'
9+
description: 'The docs-builder version to download and use'
10+
github-token:
11+
required: true
12+
description: 'GitHub token'
13+
default: '${{ github.token }}'
14+
15+
runs:
16+
using: composite
17+
18+
steps:
19+
- name: acquire docs-builder binary
20+
shell: bash
21+
run: |
22+
if [[ "${DOCS_BUILDER_VERSION}" == "edge" ]]; then
23+
docker cp $(docker create --name tc ghcr.io/elastic/docs-builder:edge):/app/docs-builder . && docker rm tc
24+
exit 0;
25+
fi
26+
27+
if [[ "${DOCS_BUILDER_VERSION}" == "latest" ]]; then
28+
DOCS_BUILDER_VERSION="" # empty string to get the latest version
29+
fi
30+
31+
gh release download "${DOCS_BUILDER_VERSION}" --pattern 'docs-builder-linux-x64.zip' --repo elastic/docs-builder
32+
gh attestation verify ./docs-builder-linux-x64.zip -R elastic/docs-builder
33+
unzip -p ./docs-builder-linux-x64.zip docs-builder > docs-builder
34+
35+
env:
36+
DOCS_BUILDER_VERSION: '${{ inputs.version }}'
37+
GH_TOKEN: '${{ inputs.github-token }}'
38+
39+
- name: Add builder to /usr/local/bin
40+
shell: bash
41+
run: |
42+
cp docs-builder /usr/local/bin/docs-builder
43+
chmod +x /usr/local/bin/docs-builder
44+
echo "::notice::docs-builder-version=$(docs-builder --version)"

0 commit comments

Comments
 (0)