Generate plugin repo YAML in CI #73
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: Build, Test and Snapshot Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| pull_request: | |
| schedule: | |
| - cron: "0 0 * * 0" # Weekly on Sunday at midnight | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| lint-and-test-python: | |
| name: Python Test Suite | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || github.event_name == 'push' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Setup Python test environment | |
| run: | | |
| cd test | |
| python -m venv venv | |
| source venv/bin/activate | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt | |
| - name: Run Python linting | |
| run: | | |
| cd test | |
| source venv/bin/activate | |
| ../scripts/lint-python.sh ci | |
| build: | |
| name: Build and Test Go Plugin | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| go-version: [">=1.23.5"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Install dependencies | |
| run: go mod tidy -e || true | |
| - name: Lint Go files | |
| run: | | |
| echo "🔍 Running go fmt..." | |
| go fmt . | |
| echo "🔍 Running go vet..." | |
| go vet . | |
| - name: Build binary | |
| run: | | |
| echo "🔨 Building binary..." | |
| python3 .github/workflows/build.py | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cf-cli-java-plugin-${{ matrix.os }} | |
| path: dist/ | |
| release: | |
| name: Create Snapshot Release | |
| needs: [build, lint-and-test-python] | |
| runs-on: ubuntu-latest | |
| if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (needs.lint-and-test-python.result == 'success' || needs.lint-and-test-python.result == 'skipped') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Python dependencies for plugin repo generation | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install PyYAML | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/ | |
| - name: Combine all artifacts | |
| run: | | |
| mkdir -p dist | |
| mv dist/*/* dist/ || true | |
| - name: Generate plugin repository YAML for snapshot | |
| env: | |
| GITHUB_REF_NAME: snapshot | |
| run: | | |
| echo "📝 Generating plugin repository YAML file..." | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| python3 -m pip install --upgrade pip | |
| pip install PyYAML requests | |
| python3 .github/workflows/generate_plugin_repo.py | |
| echo "✅ Plugin repository YAML generated" | |
| - uses: thomashampson/delete-older-releases@main | |
| with: | |
| keep_latest: 0 | |
| delete_tag_regex: snapshot | |
| prerelease_only: true | |
| delete_tags: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dist/* | |
| plugin-repo-entry.yml | |
| plugin-repo-summary.txt | |
| prerelease: false | |
| draft: true | |
| tag_name: snapshot | |
| body: | | |
| This is a snapshot release of the cf-cli-java-plugin. | |
| It includes the latest changes and is not intended for production use. | |
| Please test it and provide feedback. | |
| ## Build Status | |
| - ✅ Go Plugin: Built on Linux, macOS, and Windows | |
| - ✅ Python Tests: Linting and test suite validation completed | |
| - ✅ Plugin Repository: YAML entry generated automatically | |
| ## Plugin Repository Entry | |
| The `plugin-repo-entry.yml` file contains the snapshot entry for the CF CLI plugin repository. | |
| **Note:** This is a snapshot release - use the latest stable release for production. | |
| ## Changes | |
| This snapshot includes the latest commits from the repository. | |
| name: Snapshot Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |