Skip to content

Manual Release

Manual Release #8

Workflow file for this run

name: Manual Release
on:
workflow_dispatch: # Allows manual triggering
inputs:
version:
description: 'Release version (e.g., 3.0.4), you must have a changelog ready for this version (e.h. 3.0.4-snapshot-20231001)'
required: true
type: string
permissions:
contents: write
actions: read
jobs:
release:
name: Create Proper Release on All Platforms
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@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install PyYAML
- name: Install dependencies
run: go mod tidy -e || true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: latest
- name: Lint Go files
run: ./scripts/lint-go.sh ci
- name: Run tests
run: ./scripts/lint-go.sh ci
- name: Build binary
run: python3 .github/workflows/build.py
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: dist/
create-release:
name: Create GitHub Release with Plugin Repository Entry
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Python dependencies
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip
pip install PyYAML requests
- name: Parse version and update Go source
run: |
# Parse version input (e.g., "4.1.0" -> major=4, minor=1, build=0)
VERSION="${{ github.event.inputs.version }}"
IFS='.' read -r MAJOR MINOR BUILD <<< "$VERSION"
echo "Updating version to $MAJOR.$MINOR.$BUILD"
python3 .github/workflows/update_version.py "$MAJOR" "$MINOR" "$BUILD"
# Configure git
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# Check if there are changes
if git diff --quiet; then
echo "No version changes detected"
else
echo "Committing version update"
git add cf_cli_java_plugin.go README.md
git commit -m "Set version to v$VERSION"
git push
fi
- name: Create and push tag
run: |
VERSION="${{ github.event.inputs.version }}"
echo "Creating tag $VERSION"
git tag "$VERSION"
git push origin "$VERSION"
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Combine all artifacts
run: |
mkdir -p dist
find artifacts/ -type f -exec cp {} dist/ \;
ls -la dist/
- name: Generate plugin repository YAML
env:
GITHUB_REF_NAME: ${{ github.event.inputs.version }}
run: |
source venv/bin/activate
echo "📝 Generating plugin repository YAML file for version ${{ github.event.inputs.version }}..."
python3 .github/workflows/generate_plugin_repo.py
echo "✅ Plugin repository YAML generated"
echo ""
echo "Generated files:"
ls -la plugin-repo-*
echo ""
echo "Plugin repository entry preview:"
head -20 plugin-repo-entry.yml
- name: Generate timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
files: |
dist/*
plugin-repo-entry.yml
plugin-repo-summary.txt
body_path: release_notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Summary Comment
run: |
echo "## 🚀 Release ${{ github.event.inputs.version }} Created Successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Files Generated:" >> $GITHUB_STEP_SUMMARY
echo "- Release binaries for all platforms" >> $GITHUB_STEP_SUMMARY
echo "- \`plugin-repo-entry.yml\` - CF CLI plugin repository entry" >> $GITHUB_STEP_SUMMARY
echo "- \`plugin-repo-summary.txt\` - Human-readable summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
echo "1. Download \`plugin-repo-entry.yml\` from the release" >> $GITHUB_STEP_SUMMARY
echo "2. Submit to CF CLI plugin repository" >> $GITHUB_STEP_SUMMARY
echo "3. Update documentation if needed" >> $GITHUB_STEP_SUMMARY