From 38d74a5a765a78a4f77cec85e0601dd02b91b45f Mon Sep 17 00:00:00 2001 From: Bill Maxwell Date: Thu, 15 Feb 2024 17:57:03 -0700 Subject: [PATCH] fix - version string in tauri Also start working with release by tag, then set id. Signed-off-by: Bill Maxwell --- .github/workflows/main-release.yaml | 2 +- .github/workflows/tag-release.yaml | 29 ++++++++++++++++------------- tauri/src-tauri/src/compose.rs | 10 ++++++---- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main-release.yaml b/.github/workflows/main-release.yaml index 98de488..fc91ac3 100644 --- a/.github/workflows/main-release.yaml +++ b/.github/workflows/main-release.yaml @@ -55,7 +55,7 @@ jobs: - name: Rust Cache uses: swatinem/rust-cache@v2 with: - workspaces: "./tauri/src-tauri -> target" + workspaces: "./tauri/src-tauri" - name: Set up Nodejs uses: actions/setup-node@v4 diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml index 3e46a20..b286cbf 100644 --- a/.github/workflows/tag-release.yaml +++ b/.github/workflows/tag-release.yaml @@ -51,7 +51,7 @@ jobs: - name: Rust Cache uses: swatinem/rust-cache@v2 with: - workspaces: "./tauri/src-tauri -> target" + workspaces: "./tauri/src-tauri" - name: Set up Nodejs uses: actions/setup-node@v4 @@ -69,6 +69,18 @@ jobs: id: get_release_version run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: get release id + id: get_release_id + uses: actions/github-script@v7 + with: + script: | + const release = await github.rest.repos.getReleaseByTag({ + owner: context.repo.owner, + repo: context.repo.repo, + tag: process.env.TAG + }); + echo "RELEASE_ID=${release.data.id}" >> $GITHUB_ENV + - name: Build the app uses: tauri-apps/tauri-action@v0 env: @@ -83,15 +95,6 @@ jobs: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} with: - releaseId: ${process.env.TAG} - - - name: publish release - id: publish-release - uses: actions/github-script@v7 - with: - script: | - github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: process.env.TAG, - }) + releaseId: ${process.env.RELEASE_ID} + args: --target universal-apple-darwin + projectPath: ./tauri diff --git a/tauri/src-tauri/src/compose.rs b/tauri/src-tauri/src/compose.rs index 1267187..9284fda 100644 --- a/tauri/src-tauri/src/compose.rs +++ b/tauri/src-tauri/src/compose.rs @@ -7,10 +7,12 @@ pub fn start_docker_containers() -> Result<(), String> { let home_dir = dirs::home_dir().ok_or("Could not find the home directory.")?; let rubra_dir = home_dir.join(".rubra"); - let mut version = env!("CARGO_PKG_VERSION"); - if version == "0.0.0" { - version = "main" - } + let cargo_version = env!("CARGO_PKG_VERSION"); + let version = if cargo_version == "0.0.0" { + "main".to_string() + } else { + format!("v{}", cargo_version) + }; let status = Command::new("docker-compose") .args(["pull"])