Skip to content

fix(vnc): reduce desktop resource pressure #92

fix(vnc): reduce desktop resource pressure

fix(vnc): reduce desktop resource pressure #92

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
packages: write
jobs:
verify:
uses: ./.github/workflows/ci.yml
permissions:
contents: read
create-release:
needs: verify
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Resolve release range
id: range
run: |
PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
RANGE="HEAD"
else
RANGE="${PREV_TAG}..HEAD"
fi
echo "prev_tag=${PREV_TAG}" >> "$GITHUB_OUTPUT"
echo "range=${RANGE}" >> "$GITHUB_OUTPUT"
- name: Generate release notes (monorepo grouped)
id: changelog
run: |
bash scripts/release/generate-release-notes.sh \
"${{ steps.version.outputs.version }}" \
"${{ steps.range.outputs.range }}" \
"${{ steps.range.outputs.prev_tag }}" \
> RELEASE_BODY.md
{
echo 'body<<CHANGELOG_EOF'
cat RELEASE_BODY.md
echo 'CHANGELOG_EOF'
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}
draft: false
prerelease: false
- name: Update CHANGELOG.md in default branch
continue-on-error: true
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
VERSION: ${{ steps.version.outputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin "${DEFAULT_BRANCH}"
git checkout -B "${DEFAULT_BRANCH}" "origin/${DEFAULT_BRANCH}"
if [ ! -f CHANGELOG.md ]; then
printf '%s\n' \
'# Changelog' \
'' \
'All notable changes to this project are documented in this file.' \
'' \
'<!-- release-entries -->' \
> CHANGELOG.md
fi
if grep -q "^## v${VERSION} " CHANGELOG.md; then
echo "CHANGELOG.md already contains v${VERSION}, skip."
exit 0
fi
DATE_UTC="$(date -u +%Y-%m-%d)"
awk -v version="${VERSION}" -v date_utc="${DATE_UTC}" '
{
print
if ($0 == "<!-- release-entries -->" && !done) {
print ""
print "## v" version " - " date_utc
while ((getline line < "RELEASE_BODY.md") > 0) {
print line
}
print ""
done = 1
}
}
' CHANGELOG.md > CHANGELOG.md.tmp
mv CHANGELOG.md.tmp CHANGELOG.md
if git diff --quiet -- CHANGELOG.md; then
echo "No CHANGELOG diff, skip commit."
exit 0
fi
git add CHANGELOG.md
git commit -m "docs(changelog): update for v${VERSION}"
git push origin "HEAD:${DEFAULT_BRANCH}"
build-binaries:
needs: create-release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build cloud-claude
env:
CGO_ENABLED: "0"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
VERSION="${{ needs.create-release.outputs.version }}"
LDFLAGS="-s -w -X main.Version=${VERSION}"
BINARY="cloud-claude-${{ matrix.goos }}-${{ matrix.goarch }}"
go build -ldflags "${LDFLAGS}" -trimpath -o "${BINARY}" ./cmd/cloud-claude
- name: Compress binary
run: |
BINARY="cloud-claude-${{ matrix.goos }}-${{ matrix.goarch }}"
ARCHIVE="cloud-claude-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz"
tar czf "${ARCHIVE}" "${BINARY}"
sha256sum "${ARCHIVE}" > "${ARCHIVE}.sha256"
- name: Upload to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ARCHIVE="cloud-claude-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz"
gh release upload "${{ github.ref_name }}" "${ARCHIVE}" "${ARCHIVE}.sha256" --clobber
update-homebrew:
needs: [create-release, build-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download sha256 files from release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
for platform in darwin-amd64 darwin-arm64 linux-amd64 linux-arm64; do
gh release download "${TAG}" -p "cloud-claude-${platform}.tar.gz.sha256"
done
- name: Extract checksums
id: shas
run: |
extract_sha() { awk '{print $1}' "cloud-claude-${1}.tar.gz.sha256"; }
echo "darwin_amd64=$(extract_sha darwin-amd64)" >> "$GITHUB_OUTPUT"
echo "darwin_arm64=$(extract_sha darwin-arm64)" >> "$GITHUB_OUTPUT"
echo "linux_amd64=$(extract_sha linux-amd64)" >> "$GITHUB_OUTPUT"
echo "linux_arm64=$(extract_sha linux-arm64)" >> "$GITHUB_OUTPUT"
- name: Generate Formula
run: |
bash scripts/release/generate-homebrew-formula.sh \
"${{ needs.create-release.outputs.version }}" \
"${{ steps.shas.outputs.darwin_amd64 }}" \
"${{ steps.shas.outputs.darwin_arm64 }}" \
"${{ steps.shas.outputs.linux_amd64 }}" \
"${{ steps.shas.outputs.linux_arm64 }}" \
> cloud-claude.rb
- name: Push to Homebrew tap
env:
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
git clone "https://x-access-token:${TAP_TOKEN}@github.com/ZaneL1u/homebrew-tap.git" tap-repo
mkdir -p tap-repo/Formula
cp cloud-claude.rb tap-repo/Formula/cloud-claude.rb
cd tap-repo
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/cloud-claude.rb
if git diff --cached --quiet; then
echo "Formula unchanged, skip."
else
git commit -m "cloud-claude ${GITHUB_REF_NAME}"
git push
fi
publish-images:
needs: create-release
uses: ./.github/workflows/build-images.yml
with:
version: ${{ needs.create-release.outputs.version }}
permissions:
contents: read
packages: write