forked from wso2/api-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (165 loc) · 7.59 KB
/
cli-release.yml
File metadata and controls
198 lines (165 loc) · 7.59 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CLI Release
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine version from VERSION file
id: version
run: |
VERSION=$(make -C cli/src version-get-release --no-print-directory)
echo "Releasing CLI version: ${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Set version
run: |
VERSION=${{ steps.version.outputs.version }}
make -C cli/src version-set VERSION=${VERSION} --no-print-directory
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.1'
cache: false
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests
run: make test-cli
- name: Build binaries for all platforms
working-directory: ./cli/src
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
make build-all-skip-tests VERSION=$VERSION
- name: Package platform zips
working-directory: ./cli/src/build
env:
VERSION: ${{ steps.version.outputs.version }}
GITHUB_WORKSPACE: ${{ github.workspace }}
run: |
set -euo pipefail
VERSION=${VERSION}
mkdir -p "$GITHUB_WORKSPACE/release-artifacts"
platforms=(
"darwin-arm64"
"darwin-amd64"
"linux-arm64"
"linux-amd64"
"windows-arm64"
"windows-amd64"
)
for p in "${platforms[@]}"; do
base="ap-${p}"
zipname="${base}-v${VERSION}.zip"
dir="${base}-v${VERSION}"
tmpdir="tmp_release_${p}"
mkdir -p "$tmpdir/$dir"
# Source binary path
if [[ "$p" == windows-* ]]; then
src="${base}.exe"
destname="ap.exe"
else
src="${base}"
destname="ap"
fi
if [[ -f "$src" ]]; then
cp "$src" "$tmpdir/$dir/$destname"
if [[ "$destname" == "ap" ]]; then
chmod +x "$tmpdir/$dir/$destname" || true
fi
else
# create an empty placeholder file so zip is not empty
touch "$tmpdir/$dir/README.txt"
echo "Binary $src not found in build output." > "$tmpdir/$dir/README.txt"
fi
# Create zip with top-level directory
(cd "$tmpdir" && zip -r "$zipname" "$dir")
mv "$tmpdir/$zipname" "$GITHUB_WORKSPACE/release-artifacts/"
rm -rf "$tmpdir"
done
# Remove raw binaries to keep only zip artifacts
rm -f ap-* || true
ls -lh "$GITHUB_WORKSPACE/release-artifacts"
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
git commit -am "Release CLI version ${{ steps.version.outputs.version }}"
fi
git tag -a ap/v${{ steps.version.outputs.version }} -m "CLI (ap) ${{ steps.version.outputs.version }}"
git push origin ap/v${{ steps.version.outputs.version }}
- name: Create GitHub Release and upload assets
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ap/v${{ steps.version.outputs.version }}
name: "WSO2 API Platform Controller (ap) v${{ steps.version.outputs.version }} is Released!"
body: |
## Overview
The **WSO2 API Platform CLI (ap)** is a command-line tool for managing and interacting with the WSO2 API Platform. It provides capabilities to deploy API configurations, customize gateway policies, and manage platform resources.
## Quick Start
Get started with the [Quick Start Guide](https://github.com/wso2/api-platform/blob/main/docs/cli/quick-start-guide.md) to install and configure the CLI.
## Documentation
For complete documentation on all features and capabilities, see the [CLI Documentation](https://github.com/wso2/api-platform/tree/main/docs/cli).
- [CLI Reference](https://github.com/wso2/api-platform/blob/main/docs/cli/reference.md)
- [Customizing Gateway Policies](https://github.com/wso2/api-platform/blob/main/docs/cli/customizing-gateway-policies.md)
### Known Issues
All the open issues pertaining to WSO2 API Platform CLI are reported [here](https://github.com/wso2/api-platform/issues?q=is%3Aissue%20state%3Aopen%20label%3AArea%2FCLI).
### How To Contribute
Your feedback is most welcome!
### Community
You can use our Discord Channel and Stackoverflow Collective to engage with a wider audience https://wso2.com/community/
### Reporting Issues
We encourage you to report issues, improvements, and feature requests regarding WSO2 API Platform CLI through [WSO2 API Platform GIT Issues](https://github.com/wso2/api-platform/issues).
And please be advised that security issues must be reported to [security@wso2.com](mailto:security@wso2.com), not as a GitHub issue, in order to reach the proper audience. We strongly advise following the [WSO2 Security Vulnerability Reporting Guidelines](https://docs.wso2.com/display/Security/WSO2+Security+Vulnerability+Reporting+Guidelines) when reporting security issues.
draft: false
prerelease: true
files: |
release-artifacts/ap-darwin-arm64-v${{ steps.version.outputs.version }}.zip
release-artifacts/ap-darwin-amd64-v${{ steps.version.outputs.version }}.zip
release-artifacts/ap-linux-arm64-v${{ steps.version.outputs.version }}.zip
release-artifacts/ap-linux-amd64-v${{ steps.version.outputs.version }}.zip
release-artifacts/ap-windows-arm64-v${{ steps.version.outputs.version }}.zip
release-artifacts/ap-windows-amd64-v${{ steps.version.outputs.version }}.zip
- name: Upload release zips as workflow artifacts
uses: actions/upload-artifact@v4
with:
name: ap-release-zips-${{ steps.version.outputs.version }}
path: release-artifacts/*.zip
- name: Bump to next dev version
run: make -C cli/src version-bump-next-dev
- name: Commit version bump
run: |
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
git commit -am "Bump CLI to next dev version"
else
echo "No changes to commit"
fi
- name: Create PR for version bump
id: create-pr
uses: peter-evans/create-pull-request@v6
with:
commit-message: "Bump CLI to next dev version"
title: "chore: Bump CLI to next dev version"
body: |
Automated version bump after release `ap/v${{ steps.version.outputs.version }}`
This PR bumps the CLI version to the next development version.
branch: cli-version-bump-${{ github.run_id }}
base: main
delete-branch: true
assignees: renuka-fernando
labels: |
automated
version-bump