Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ jobs:
shared-key: "ci-check"

- name: Check compilation
run: cargo check --all-targets
run: cargo check --workspace

# ── Frontend: build ────────────────────────────────────────────────
frontend-build:
name: Frontend Build
runs-on: ubuntu-latest
env:
NODE_OPTIONS: --max-old-space-size=6144
steps:
- uses: actions/checkout@v4

Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/desktop-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
description: "Tag name to build (e.g. v0.2.0). Leave empty to build from HEAD."
required: false
type: string
upload_to_release:
description: "Upload built artifacts to the release specified by tag_name."
required: false
default: false
type: boolean

permissions:
contents: write
Expand All @@ -30,17 +35,24 @@ jobs:
- name: Resolve version metadata
id: meta
shell: bash
env:
INPUT_TAG_NAME: ${{ inputs.tag_name }}
INPUT_UPLOAD_TO_RELEASE: ${{ inputs.upload_to_release }}
run: |
set -euo pipefail

if [[ "${{ github.event_name }}" == "release" ]]; then
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG#v}"
UPLOAD="true"
elif [[ -n "${{ inputs.tag_name }}" ]]; then
TAG="${{ inputs.tag_name }}"
elif [[ -n "${INPUT_TAG_NAME}" ]]; then
TAG="${INPUT_TAG_NAME}"
VERSION="${TAG#v}"
UPLOAD="false"
if [[ "${INPUT_UPLOAD_TO_RELEASE}" == "true" ]]; then
UPLOAD="true"
else
UPLOAD="false"
fi
else
VERSION="$(jq -r '.version' package.json)"
TAG="v${VERSION}"
Expand All @@ -56,6 +68,8 @@ jobs:
name: Package (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.os }}
needs: prepare
env:
NODE_OPTIONS: --max-old-space-size=6144

strategy:
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ jobs:
runs-on: ${{ matrix.platform.os }}
needs: check-changes
if: needs.check-changes.outputs.should_build == 'true'
env:
NODE_OPTIONS: --max-old-space-size=6144

strategy:
fail-fast: false
Expand Down
108 changes: 82 additions & 26 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,95 @@
name: Release Please
name: Release On Version Bump

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write
actions: write

jobs:
release-please:
name: Release Please
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: googleapis/release-please-action@v4
id: release
- uses: actions/checkout@v4
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

# When a release is created, trigger the desktop package workflow
trigger-package:
name: Trigger Desktop Package
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Log release info
fetch-depth: 0

- name: Detect version bump
id: detect
shell: bash
env:
BEFORE_SHA: ${{ github.event.before }}
run: |
echo "Release created: ${{ needs.release-please.outputs.tag_name }}"
echo "Version: ${{ needs.release-please.outputs.version }}"
set -euo pipefail

CURRENT_VERSION="$(jq -r '.version' package.json)"
TAG_NAME="v${CURRENT_VERSION}"

echo "current_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"

# First push to branch or unknown previous commit
if [[ -z "${BEFORE_SHA}" || "${BEFORE_SHA}" =~ ^0+$ ]]; then
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "reason=before_sha_unavailable" >> "$GITHUB_OUTPUT"
exit 0
fi

PREV_VERSION="$(git show "${BEFORE_SHA}:package.json" 2>/dev/null | jq -r '.version' 2>/dev/null || true)"

if [[ -z "${PREV_VERSION}" ]]; then
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "reason=previous_version_unavailable" >> "$GITHUB_OUTPUT"
exit 0
fi

if [[ "$CURRENT_VERSION" == "$PREV_VERSION" ]]; then
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "reason=version_unchanged" >> "$GITHUB_OUTPUT"
exit 0
fi

if git ls-remote --exit-code --tags origin "refs/tags/${TAG_NAME}" >/dev/null 2>&1; then
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "reason=tag_exists" >> "$GITHUB_OUTPUT"
exit 0
fi

echo "previous_version=$PREV_VERSION" >> "$GITHUB_OUTPUT"
echo "should_release=true" >> "$GITHUB_OUTPUT"
echo "reason=version_changed" >> "$GITHUB_OUTPUT"

- name: Log decision
shell: bash
run: |
echo "Decision: ${{ steps.detect.outputs.reason }}"
echo "Current version: ${{ steps.detect.outputs.current_version }}"
echo "Tag: ${{ steps.detect.outputs.tag_name }}"

- name: Create GitHub release
if: steps.detect.outputs.should_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.detect.outputs.tag_name }}
target_commitish: ${{ github.sha }}
generate_release_notes: true

- name: Trigger desktop package workflow
if: steps.detect.outputs.should_release == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: "desktop-package.yml",
ref: context.ref.replace("refs/heads/", ""),
inputs: {
tag_name: "${{ steps.detect.outputs.tag_name }}",
upload_to_release: "true"
}
});
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.1.1"
}
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resolver = "2"

# Shared package metadata — single source of truth for version
[workspace.package]
version = "0.1.0" # x-release-please-version
version = "0.1.1" # x-release-please-version
authors = ["BitFun Team"]
edition = "2021"

Expand Down Expand Up @@ -89,6 +89,7 @@ eventsource-stream = "0.2.3"
# Command detection (cross-platform)
which = "8.0"
similar = "2.5"
urlencoding = "2.1"

# Tauri (desktop only)
tauri = { version = "2", features = [] }
Expand All @@ -113,4 +114,3 @@ opt-level = 3
lto = true
codegen-units = 1
strip = true

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "BitFun",
"private": true,
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"scripts": {
"copy-monaco": "copyfiles -u 3 \"node_modules/monaco-editor/min/vs/**/*\" src/web-ui/public/monaco-editor",
Expand Down
1 change: 1 addition & 0 deletions src/apps/desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ once_cell = { workspace = true }
similar = { workspace = true }
dashmap = { workspace = true }
ignore = { workspace = true }
urlencoding = { workspace = true }

[target.'cfg(windows)'.dependencies]
win32job = { workspace = true }
2 changes: 1 addition & 1 deletion src/web-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bitfun/web-ui",
"version": "0.1.0",
"version": "0.1.1",
"description": "BitFun Web UI - 支持 Desktop 和 Server 两种部署方式",
"type": "module",
"scripts": {
Expand Down