name: Release CLI on: push: tags: - 'cli-v*' jobs: release: runs-on: ubuntu-22.04 permissions: contents: write steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: actions/setup-go@v6 with: go-version: '>=1.25.0' - name: Extract version from tag id: version run: | TAG=${GITHUB_REF#refs/tags/cli-v} echo "version=$TAG" >> $GITHUB_OUTPUT echo "Releasing version: $TAG" - name: Install dependencies run: make install - name: Run CLI tests run: make test-cli - name: Run E2E tests run: make test-e2e - name: Build CLI run: make version=${{ steps.version.outputs.version }} build-cli - name: Generate changelog run: | VERSION="${{ steps.version.outputs.version }}" TAG="cli-v${VERSION}" # Find previous CLI tag PREV_TAG=$(git tag --sort=-version:refname | grep "^cli-" | grep -v "^${TAG}$" | head -n 1) if [ -z "$PREV_TAG" ]; then echo "Error: No previous CLI tag found" echo "This appears to be the first release." exit 1 fi ./scripts/generate-changelog.sh cli "$TAG" "$PREV_TAG" > /tmp/changelog.txt cat /tmp/changelog.txt - name: Create GitHub release env: GH_TOKEN: ${{ github.token }} run: | VERSION="${{ steps.version.outputs.version }}" TAG="cli-v${VERSION}" # Determine if prerelease (version not matching major.minor.patch) FLAGS="" if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then FLAGS="--prerelease" fi gh release create "$TAG" \ build/cli/*.tar.gz \ build/cli/*_checksums.txt \ $FLAGS \ --title="$TAG" \ --notes-file=/tmp/changelog.txt \ --draft