Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

ci: support desktop

PairZhudb3b5b2d57ae
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
new file mode 100644
index 00000000..eb50d708
--- /dev/null
+++ b/.github/workflows/desktop-release.yml
@@ -0,0 +1,166 @@
+name: desktop-release
+
+on:
+ workflow_run:
+ workflows: ["release"]
+ types:
+ - completed
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Tag to build (e.g. v1.0.0)'
+ required: true
+ type: string
+
+permissions:
+ contents: write
+
+jobs:
+ prepare:
+ runs-on: ubuntu-latest
+ if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
+ outputs:
+ tag: ${{ steps.tag.outputs.tag }}
+ commit_sha: ${{ steps.commit_sha.outputs.commit_sha }}
+ upload_url: ${{ steps.upload_url.outputs.upload_url }}
+ steps:
+ - name: Get Commit SHA
+ id: commit_sha
+ uses: actions/github-script@v7
+ with:
+ script: |
+ let sha;
+ if (context.eventName === 'workflow_dispatch') {
+ // For manual triggers, get the commit SHA for the specified tag
+ try {
+ const { data: ref } = await github.rest.git.getRef({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ ref: `tags/${context.payload.inputs.tag}`
+ });
+
+ if (ref.object.type === 'tag') {
+ // If the tag is an annotated tag, we need to fetch the commit ID from the tag's object
+ const { data: tagObject } = await github.rest.git.getTag({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ tag_sha: ref.object.sha
+ });
+ sha = tagObject.object.sha; // The sha of the commit the annotated tag points to
+ } else {
+ sha = ref.object.sha; // Direct commit SHA for lightweight tag
+ }
+
+ } catch (error) {
+ throw new Error(`Failed to get commit SHA for tag ${context.payload.inputs.tag}: ${error.message}`);
+ }
+ } else {
+ // For workflow_run triggers, use the commit SHA from the workflow_run event
+ sha = context.payload.workflow_run.head_sha;
+ }
+
+ console.log(`Commit SHA: ${sha}`);
+ core.setOutput('commit_sha', sha);
+
+ - name: Get Tag
+ id: tag
+ uses: actions/github-script@v7
+ with:
+ script: |
+ let tag;
+ if (context.eventName === 'workflow_dispatch') {
+ tag = context.payload.inputs.tag;
+ } else {
+ // Get the tag from the workflow_run event
+ tag = context.payload.workflow_run.head_branch;
+ }
+ console.log(`Tag: ${tag}`);
+ core.setOutput('tag', tag);
+
+ - name: Get Upload URL
+ id: upload_url
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const { data: release } = await github.rest.repos.getReleaseByTag({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ tag: '${{ steps.tag.outputs.tag }}',
+ });
+ console.log(`Upload URL: ${release.upload_url}`);
+ core.setOutput('upload_url', release.upload_url);
+
+ build:
+ needs: prepare
+ if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: darwin
+ arch: amd64
+ suffix: _amd64
+ display_os: macOS
+ - os: darwin
+ arch: arm64
+ suffix: _arm64
+ display_os: macOS
+ - os: windows
+ arch: amd64
+ suffix: .exe
+ display_os: Windows
+ - os: windows
+ arch: 386
+ suffix: _i386.exe
+ display_os: Windows
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ needs.prepare.outputs.commit_sha }}
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version-file: 'go.mod'
+
+ - name: Install XGO
+ run: |
+ go install src.techknowlogick.com/xgo@latest
+
+ - name: Build Binary
+ run: |
+ xgo --targets=${{ matrix.os }}/${{ matrix.arch }} \
+ --out krillinai_desktop \
+ ./cmd/desktop
+
+ - name: Rename Binary
+ run: |
+ mv krillinai_desktop* KrillinAI_Desktop${{ matrix.suffix }}
+
+ - name: Get Version
+ id: version
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const rawTag = '${{ needs.prepare.outputs.tag }}';
+ const version = rawTag.replace(/^v/, ''); // Remove the leading 'v' if present
+ console.log(`Version: ${version}`);
+ core.setOutput('version', version);
+
+ - name: Upload Binary
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ needs.prepare.outputs.upload_url }}
+ asset_path: KrillinAI_Desktop${{ matrix.suffix }}
+ asset_name: KrillinAI_Desktop_${{ steps.version.outputs.version }}_${{ matrix.display_os }}${{ matrix.suffix }}
+ asset_content_type: application/octet-stream
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9c21eb6e..f407cbae 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -14,34 +14,34 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- - name: Set up Go
- uses: actions/setup-go@v5
- with:
- go-version-file: 'go.mod'
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version-file: 'go.mod'
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v3
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v3
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
-
- - name: Login to Docker Hub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
- - name: Run GoReleaser
- uses: goreleaser/goreleaser-action@v6
- with:
- distribution: goreleaser
- version: latest
- args: release --clean
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
+ - name: Run GoReleaser
+ uses: goreleaser/goreleaser-action@v6
+ with:
+ distribution: goreleaser
+ version: latest
+ args: release --clean
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}