Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions actions/setup-docs-builder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
this documentation was generated by https://github.com/reakaleek/gh-action-readme
with the command `VERSION=main gh action-readme update`
-->

# <!--name-->Set up docs-builder CLI<!--/name-->

<!--description-->
Set up docs-builder CLI for use in actions
<!--/description-->

## Inputs

<!--inputs-->
| Name | Description | Required | Default |
|----------------|----------------------------------------------|----------|-----------------------|
| `version` | The docs-builder version to download and use | `false` | `latest` |
| `github-token` | GitHub token | `true` | `${{ github.token }}` |
<!--/inputs-->

## Outputs
<!--outputs-->
| Name | Description |
|------|-------------|
<!--/outputs-->

## Usage

<!--usage action="elastic/docs-builder/actions/setup-docs-builder" version="env:VERSION"-->
```yaml

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up docs-builder
uses: elastic/docs-builder/actions/setup-docs-builder@main
version: 'latest'

- run: docs-builder --version
```
<!--/usage-->
44 changes: 44 additions & 0 deletions actions/setup-docs-builder/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Set up docs-builder CLI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can reuse https://github.com/elastic/docs-builder/blob/main/action.yml for this?

version could be used to select the image?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh no you can't use variables in the image declaration, I tried this once :)


description: 'Set up docs-builder CLI for use in actions'

inputs:
version:
required: false
default: 'latest'
description: 'The docs-builder version to download and use'
github-token:
required: true
description: 'GitHub token'
default: '${{ github.token }}'

runs:
using: composite

steps:
- name: acquire docs-builder binary
shell: bash
run: |
if [[ "${DOCS_BUILDER_VERSION}" == "edge" ]]; then
docker cp $(docker create --name tc ghcr.io/elastic/docs-builder:edge):/app/docs-builder . && docker rm tc
exit 0;
fi

if [[ "${DOCS_BUILDER_VERSION}" == "latest" ]]; then
DOCS_BUILDER_VERSION="" # empty string to get the latest version
fi

gh release download "${DOCS_BUILDER_VERSION}" --pattern 'docs-builder-linux-x64.zip' --repo elastic/docs-builder
gh attestation verify ./docs-builder-linux-x64.zip -R elastic/docs-builder
unzip -p ./docs-builder-linux-x64.zip docs-builder > docs-builder

env:
DOCS_BUILDER_VERSION: '${{ inputs.version }}'
GH_TOKEN: '${{ inputs.github-token }}'

- name: Add builder to /usr/local/bin
shell: bash
run: |
cp docs-builder /usr/local/bin/docs-builder
chmod +x /usr/local/bin/docs-builder
echo "::notice::docs-builder-version=$(docs-builder --version)"
Loading