-
Notifications
You must be signed in to change notification settings - Fork 14
175 lines (147 loc) · 5.47 KB
/
release.yml
File metadata and controls
175 lines (147 loc) · 5.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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.g. 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 "action@github.com"
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 "${{ github.event.inputs.version }}"
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