CLI Release #3
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: 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=$(cat cli/VERSION | tr -d '[:space:]' | sed 's/-SNAPSHOT//') | |
| if [[ -z "${VERSION}" ]]; then | |
| echo "::error::VERSION is empty or contains only whitespace. Check cli/VERSION file." >&2 | |
| exit 1 | |
| fi | |
| echo "Releasing CLI version: ${VERSION}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Set version | |
| run: | | |
| VERSION=${{ steps.version.outputs.version }} | |
| make version-set COMPONENT=cli VERSION_ARG=${VERSION} | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25.1' | |
| - 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: Set to next dev version | |
| run: | | |
| make version-bump-next-dev COMPONENT=cli | |
| git commit -am "Bump CLI to next dev version" | |
| git push origin main |