Skip to content

Commit fc8843e

Browse files
committed
Generate plugin repo YAML in CI
1 parent 6a4dbfd commit fc8843e

File tree

2 files changed

+99
-33
lines changed

2 files changed

+99
-33
lines changed

.github/workflows/build-and-snapshot.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ jobs:
2525
with:
2626
python-version: "3.11"
2727

28-
- name: Check if Python tests exist
29-
id: check-tests
30-
run: |
31-
if [ -f "test/requirements.txt" ] && [ -f "test/test.sh" ]; then
32-
echo "tests_exist=true" >> $GITHUB_OUTPUT
33-
echo "✅ Python test suite found"
34-
else
35-
echo "tests_exist=false" >> $GITHUB_OUTPUT
36-
echo "⚠️ Python test suite not found - skipping tests"
37-
fi
3828

3929
- name: Setup Python test environment
4030
if: steps.check-tests.outputs.tests_exist == 'true'
@@ -46,21 +36,11 @@ jobs:
4636
python -m pip install -r requirements.txt
4737
4838
- name: Run Python linting
49-
if: steps.check-tests.outputs.tests_exist == 'true'
5039
run: |
5140
cd test
5241
source venv/bin/activate
5342
../scripts/lint-python.sh ci
5443
55-
# - name: Run Python tests
56-
# if: steps.check-tests.outputs.tests_exist == 'true'
57-
# run: |
58-
# cd testing
59-
# source venv/bin/activate
60-
# echo "🧪 Running Python tests..."
61-
# pytest -v --tb=short
62-
# echo "✅ Python tests completed!"
63-
6444
build:
6545
name: Build and Test Go Plugin
6646
runs-on: ${{ matrix.os }}
@@ -106,6 +86,19 @@ jobs:
10686
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')
10787

10888
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v4
91+
92+
- name: Set up Python
93+
uses: actions/setup-python@v4
94+
with:
95+
python-version: "3.11"
96+
97+
- name: Install Python dependencies for plugin repo generation
98+
run: |
99+
python -m pip install --upgrade pip
100+
pip install PyYAML
101+
109102
- name: Download all artifacts
110103
uses: actions/download-artifact@v4
111104
with:
@@ -116,6 +109,14 @@ jobs:
116109
mkdir -p dist
117110
mv dist/*/* dist/ || true
118111
112+
- name: Generate plugin repository YAML for snapshot
113+
env:
114+
GITHUB_REF_NAME: snapshot
115+
run: |
116+
echo "📝 Generating plugin repository YAML file..."
117+
python3 .github/workflows/generate_plugin_repo.py
118+
echo "✅ Plugin repository YAML generated"
119+
119120
- uses: thomashampson/delete-older-releases@main
120121
with:
121122
keep_latest: 0
@@ -128,7 +129,10 @@ jobs:
128129
- name: Create GitHub Release
129130
uses: softprops/action-gh-release@v1
130131
with:
131-
files: dist/*
132+
files: |
133+
dist/*
134+
plugin-repo-entry.yml
135+
plugin-repo-summary.txt
132136
prerelease: false
133137
release: false
134138
tag_name: snapshot
@@ -140,6 +144,11 @@ jobs:
140144
## Build Status
141145
- ✅ Go Plugin: Built and tested on Linux, macOS, and Windows
142146
- ✅ Python Tests: Linting and test suite validation completed
147+
- ✅ Plugin Repository: YAML entry generated automatically
148+
149+
## Plugin Repository Entry
150+
The `plugin-repo-entry.yml` file contains the snapshot entry for the CF CLI plugin repository.
151+
**Note:** This is a snapshot release - use the latest stable release for production.
143152
144153
## Changes
145154
This snapshot includes the latest commits from the repository.

.github/workflows/release.yml

Lines changed: 69 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Install Python dependencies
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install PyYAML requests
37+
pip install PyYAML
3838
3939
- name: Install dependencies
4040
run: go mod tidy -e || true
@@ -48,14 +48,57 @@ jobs:
4848
- name: Build binary
4949
run: python3 .github/workflows/build.py
5050

51+
- name: Upload build artifacts
52+
uses: actions/upload-artifact@v3
53+
with:
54+
name: binaries-${{ matrix.os }}
55+
path: dist/
56+
57+
create-release:
58+
name: Create GitHub Release with Plugin Repository Entry
59+
needs: release
60+
runs-on: ubuntu-latest
61+
62+
steps:
63+
- name: Checkout code
64+
uses: actions/checkout@v3
65+
66+
- name: Set up Python
67+
uses: actions/setup-python@v4
68+
with:
69+
python-version: "3.x"
70+
71+
- name: Install Python dependencies
72+
run: |
73+
python -m pip install --upgrade pip
74+
pip install PyYAML
75+
76+
- name: Download all build artifacts
77+
uses: actions/download-artifact@v3
78+
with:
79+
path: artifacts/
80+
81+
- name: Combine all artifacts
82+
run: |
83+
mkdir -p dist
84+
find artifacts/ -type f -exec cp {} dist/ \;
85+
ls -la dist/
86+
5187
- name: Generate plugin repository YAML
52-
if: matrix.os == 'ubuntu-latest' # Only run on one platform
5388
env:
5489
GITHUB_REF_NAME: v${{ github.event.inputs.version }}
55-
run: python3 .github/workflows/generate_plugin_repo.py
90+
run: |
91+
echo "📝 Generating plugin repository YAML file for version ${{ github.event.inputs.version }}..."
92+
python3 .github/workflows/generate_plugin_repo.py
93+
echo "✅ Plugin repository YAML generated"
94+
echo ""
95+
echo "Generated files:"
96+
ls -la plugin-repo-*
97+
echo ""
98+
echo "Plugin repository entry preview:"
99+
head -20 plugin-repo-entry.yml
56100
57101
- name: Create GitHub Release
58-
if: matrix.os == 'ubuntu-latest' # Only create release once
59102
uses: softprops/action-gh-release@v1
60103
with:
61104
tag_name: v${{ github.event.inputs.version }}
@@ -85,19 +128,33 @@ jobs:
85128
86129
The `plugin-repo-entry.yml` file contains the entry that should be added to the CF CLI plugin repository.
87130
131+
**To submit to CF CLI plugin repository:**
132+
1. Fork [cli-plugin-repo](https://github.com/cloudfoundry-incubator/cli-plugin-repo)
133+
2. Add the contents of `plugin-repo-entry.yml` to `repo-index.yml`
134+
3. Create a pull request
135+
88136
### Supported Platforms
89137
90138
- Linux (32-bit and 64-bit)
91139
- macOS (64-bit)
92140
- Windows (32-bit and 64-bit)
141+
142+
### Checksums
143+
144+
All binaries include SHA1 checksums for verification. See `plugin-repo-summary.txt` for details.
93145
env:
94146
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95147

96-
- name: Upload plugin repository artifacts
97-
if: matrix.os == 'ubuntu-latest'
98-
uses: actions/upload-artifact@v3
99-
with:
100-
name: plugin-repository-files
101-
path: |
102-
plugin-repo-entry.yml
103-
plugin-repo-summary.txt
148+
- name: Create Summary Comment
149+
run: |
150+
echo "## 🚀 Release v${{ github.event.inputs.version }} Created Successfully!" >> $GITHUB_STEP_SUMMARY
151+
echo "" >> $GITHUB_STEP_SUMMARY
152+
echo "### Files Generated:" >> $GITHUB_STEP_SUMMARY
153+
echo "- Release binaries for all platforms" >> $GITHUB_STEP_SUMMARY
154+
echo "- \`plugin-repo-entry.yml\` - CF CLI plugin repository entry" >> $GITHUB_STEP_SUMMARY
155+
echo "- \`plugin-repo-summary.txt\` - Human-readable summary" >> $GITHUB_STEP_SUMMARY
156+
echo "" >> $GITHUB_STEP_SUMMARY
157+
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
158+
echo "1. Download \`plugin-repo-entry.yml\` from the release" >> $GITHUB_STEP_SUMMARY
159+
echo "2. Submit to CF CLI plugin repository" >> $GITHUB_STEP_SUMMARY
160+
echo "3. Update documentation if needed" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)