cli-release #28
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: Update CLI Documentation | |
| on: | |
| repository_dispatch: | |
| types: [cli-release] | |
| workflow_dispatch: | |
| inputs: | |
| cli_version: | |
| description: 'CLI version to document (e.g., 0.9.3)' | |
| required: true | |
| type: string | |
| jobs: | |
| update-cli-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout docs repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Determine CLI version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" == "repository_dispatch" ]; then | |
| VERSION="${{ github.event.client_payload.version }}" | |
| else | |
| VERSION="${{ github.event.inputs.cli_version }}" | |
| fi | |
| # Remove 'v' prefix if present | |
| VERSION="${VERSION#v}" | |
| echo "cli_version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Checkout tower-cli at release tag | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: seqeralabs/tower-cli | |
| ref: v${{ steps.version.outputs.cli_version }} | |
| path: tower-cli | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract CLI metadata | |
| run: | | |
| cd tower-cli | |
| ./gradlew extractCliMetadata | |
| cd .. | |
| cp tower-cli/docs/cli-metadata.json \ | |
| platform-cli-docs/metadata/cli-metadata-v${{ steps.version.outputs.cli_version }}.json | |
| echo "Extracted CLI metadata for v${{ steps.version.outputs.cli_version }}" | |
| - name: Compare with previous version | |
| id: compare | |
| run: | | |
| if [ -f "platform-cli-docs/metadata/cli-metadata-latest.json" ]; then | |
| if [ -f "platform-cli-docs/scripts/compare-metadata.py" ]; then | |
| python platform-cli-docs/scripts/compare-metadata.py \ | |
| platform-cli-docs/metadata/cli-metadata-latest.json \ | |
| platform-cli-docs/metadata/cli-metadata-v${{ steps.version.outputs.cli_version }}.json \ | |
| > comparison-report.md | |
| else | |
| echo "## CLI Documentation Changes" > comparison-report.md | |
| echo "" >> comparison-report.md | |
| echo "Updated CLI documentation for v${{ steps.version.outputs.cli_version }}" >> comparison-report.md | |
| fi | |
| else | |
| echo "## CLI Documentation Changes" > comparison-report.md | |
| echo "" >> comparison-report.md | |
| echo "Initial CLI documentation generation for v${{ steps.version.outputs.cli_version }}" >> comparison-report.md | |
| fi | |
| - name: Generate reference documentation | |
| run: | | |
| python platform-cli-docs/scripts/generate-cli-docs.py \ | |
| --metadata platform-cli-docs/metadata/cli-metadata-v${{ steps.version.outputs.cli_version }}.json \ | |
| --overlays platform-cli-docs/overlays \ | |
| --output platform-cli-docs/docs/reference | |
| - name: Add version information to docs | |
| run: | | |
| VERSION="${{ steps.version.outputs.cli_version }}" | |
| # Version notice to add | |
| VERSION_NOTICE=":::info CLI Version | |
| This documentation is for Seqera Platform CLI version **${VERSION}**. If you're using an older version, some commands or options described here may not be available. Update your CLI to access all documented features. | |
| :::" | |
| # Add to overview.md (after frontmatter) | |
| if [ -f "platform-cli-docs/docs/overview.md" ]; then | |
| # Insert after frontmatter (after first ---...--- block) | |
| awk -v notice="$VERSION_NOTICE" ' | |
| /^---$/ { count++ } | |
| { print } | |
| count == 2 && !inserted { print "\n" notice; inserted=1 } | |
| ' platform-cli-docs/docs/overview.md > temp_overview.md | |
| mv temp_overview.md platform-cli-docs/docs/overview.md | |
| fi | |
| # Add to commands-reference.md (after frontmatter) | |
| if [ -f "platform-cli-docs/docs/commands-reference.md" ]; then | |
| awk -v notice="$VERSION_NOTICE" ' | |
| /^---$/ { count++ } | |
| { print } | |
| count == 2 && !inserted { print "\n" notice; inserted=1 } | |
| ' platform-cli-docs/docs/commands-reference.md > temp_commands.md | |
| mv temp_commands.md platform-cli-docs/docs/commands-reference.md | |
| fi | |
| - name: Update latest symlink | |
| run: | | |
| cd platform-cli-docs/metadata | |
| rm -f cli-metadata-latest.json | |
| ln -s cli-metadata-v${{ steps.version.outputs.cli_version }}.json cli-metadata-latest.json | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: | | |
| Update CLI documentation for v${{ steps.version.outputs.cli_version }} | |
| Auto-generated from tower-cli metadata extraction. | |
| branch: cli-docs-v${{ steps.version.outputs.cli_version }} | |
| title: "CLI Docs: Update for v${{ steps.version.outputs.cli_version }}" | |
| body-path: comparison-report.md | |
| labels: | | |
| documentation | |
| cli | |
| auto-generated |