Bundle Sync #1393
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Bundle Sync | |
| on: | |
| schedule: | |
| - cron: '3 */3 * * *' | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Find versions to build | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSIONS=$(.github/scripts/sync.sh) | |
| echo "Versions to build: ${VERSIONS:-none}" | |
| echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" | |
| - name: Build bundles | |
| if: steps.check.outputs.versions != '' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y zstd | |
| git clone --depth 1 https://github.com/grafana/k6-docs.git /tmp/k6-docs | |
| for VERSION in ${{ steps.check.outputs.versions }}; do | |
| echo "=== Building $VERSION ===" | |
| rm -rf dist | |
| go run ./cmd/prepare --k6-version="$VERSION" --k6-docs-path=/tmp/k6-docs --output-dir=dist | |
| BUNDLE="docs-${VERSION}.tar.zst" | |
| tar -cf - -C dist . | zstd --ultra -22 -o "$BUNDLE" | |
| gh release delete-asset doc-bundles "$BUNDLE" --yes 2>/dev/null || true | |
| gh release upload doc-bundles "$BUNDLE" | |
| echo "=== Done: $BUNDLE ===" | |
| done |