diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index b9589537b8..5b3503313f 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -12,8 +12,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - ref: dev # Dev branch - name: Install Node uses: actions/setup-node@v4 with: diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index 9d6669f23f..3a42979c46 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -2,9 +2,6 @@ name: Dev Build on: workflow_dispatch: - # push: - # branches: - # - dev schedule: - cron: "15 0 * * *" # 每天 08:15 UTC+8 自动构建 env: @@ -32,8 +29,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - ref: dev # Dev branch - name: install Rust stable run: rustup install stable --profile minimal && rustup default stable @@ -155,8 +150,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - ref: dev # Dev branch - name: Set Env run: | echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV @@ -166,7 +159,6 @@ jobs: uses: greenhat616/update-tag@v1 with: tag_name: pre-release - ref: dev env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | @@ -195,8 +187,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - ref: dev # Dev branch - uses: pnpm/action-setup@v2 name: Install pnpm with: diff --git a/.github/workflows/puiblish.yml b/.github/workflows/puiblish.yml new file mode 100644 index 0000000000..8e8bfb7034 --- /dev/null +++ b/.github/workflows/puiblish.yml @@ -0,0 +1,79 @@ +name: Publish + +on: + workflow_dispatch: + inputs: + versionType: + type: choice + description: "" + required: true + default: "patch" + options: + - major + - minor + - patch + +jobs: + publish: + name: Publish ${{ inputs.versionType }} release + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Prepare Node + uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - name: Install + run: pnpm i + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - id: update-version + shell: bash + name: Bump version + # Use npm because yarn is for some reason not able to output only the version name + run: | + echo "version=$(pnpm run publish)" >> $GITHUB_OUTPUT + git add . + - name: Conventional Changelog Action + id: build-changelog + uses: TriPSs/conventional-changelog-action@v3 + with: + github-token: ${{ secrets.github_token }} + git-message: "chore(release): {version} 🤖 [skip ci]" + git-user-name: "github-actions[bot]" + git-user-email: "41898282+github-actions[bot]@users.noreply.github.com" + preset: "conventionalcommits" + tag-prefix: "v" + output-file: "UPDATELOG.md" + release-count: "10" + git-branch: "main" + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + body: ${{steps.build-changelog.outputs.clean_changelog}} + name: ${{steps.update-version.outputs.version}} + tag_name: ${{steps.build-changelog.outputs.tag}} + # target_commitish: ${{ steps.tag.outputs.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e30506758..60dd42f789 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,8 @@ name: Release Build on: - workflow_dispatch: - push: - branches: - - main + release: + types: [published] env: CARGO_INCREMENTAL: 0 @@ -29,8 +27,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - ref: main - name: install Rust stable run: rustup install stable --profile minimal && rustup default stable diff --git a/backend/tauri/overrides/nightly.conf.json b/backend/tauri/overrides/nightly.conf.json index f45f651e30..cd6472c9ae 100644 --- a/backend/tauri/overrides/nightly.conf.json +++ b/backend/tauri/overrides/nightly.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/1.x/tooling/cli/schema.json", "package": { - "version": "1.4.2" + "version": "1.4.3" }, "tauri": { "updater": { diff --git a/renovate.json b/renovate.json index 10f5d1fd57..da0b4df1b8 100644 --- a/renovate.json +++ b/renovate.json @@ -9,7 +9,6 @@ "default:rebaseStalePrs", "group:monorepos" ], - "baseBranches": ["dev"], "packageRules": [ { "groupName": "Bundler packages", diff --git a/scripts/generate-latest-version.ts b/scripts/generate-latest-version.ts index 5130b9ae36..28d0518537 100644 --- a/scripts/generate-latest-version.ts +++ b/scripts/generate-latest-version.ts @@ -173,14 +173,23 @@ async function main() { manifest_version: MANIFEST_VERSION, latest: {}, arch_template: {}, - updated_at: new Date().toISOString(), } as ManifestVersion; for (const result of results) { manifest.latest[result.name as SupportedCore] = result.version; manifest.arch_template[result.name as SupportedCore] = result.archMapping; } - consola.success("Generated manifest"); + await fs.ensureDir(MANIFEST_DIR); + // If no changes, skip writing manifest + const previousManifest = (await fs.readJSON(MANIFEST_VERSION_PATH)) || {}; + delete previousManifest.updated_at; + if (JSON.stringify(previousManifest) === JSON.stringify(manifest)) { + consola.success("No changes, skip writing manifest"); + return; + } + manifest.updated_at = new Date().toISOString(); + consola.success("Generated manifest"); + await fs.writeJSON(MANIFEST_VERSION_PATH, manifest, { spaces: 2 }); consola.success("Manifest written"); } diff --git a/scripts/publish.ts b/scripts/publish.ts index 5a227e2c29..e4d061bb38 100644 --- a/scripts/publish.ts +++ b/scripts/publish.ts @@ -1,10 +1,8 @@ -import { execSync } from "child_process"; import fs from "fs-extra"; import path from "node:path"; import packageJson from "../package.json"; -import { resolveUpdateLog } from "./updatelog"; import { TAURI_APP_DIR, cwd } from "./utils/env"; -import { consola } from "./utils/logger"; +// import { consola } from "./utils/logger"; const TAURI_APP_CONF_PATH = path.join(TAURI_APP_DIR, "tauri.conf.json"); const TAURI_NIGHTLY_APP_CONF_PATH = path.join( @@ -39,8 +37,8 @@ async function resolvePublish() { tauriNightlyJson.package.version = nextNightlyVersion; // 发布更新前先写更新日志 - const nextTag = `v${nextVersion}`; - await resolveUpdateLog(nextTag); + // const nextTag = `v${nextVersion}`; + // await resolveUpdateLog(nextTag); await fs.writeJSON(PACKAGE_JSON_PATH, packageJson, { spaces: 2, @@ -52,13 +50,14 @@ async function resolvePublish() { spaces: 2, }); - execSync("git add ./package.json"); - execSync(`git add ${TAURI_APP_CONF_PATH}`); - execSync(`git commit -m "v${nextVersion}"`); - execSync(`git tag -a v${nextVersion} -m "v${nextVersion}"`); - execSync(`git push`); - execSync(`git push origin v${nextVersion}`); - consola.success(`Publish Successfully...`); + // execSync("git add ./package.json"); + // execSync(`git add ${TAURI_APP_CONF_PATH}`); + // execSync(`git commit -m "v${nextVersion}"`); + // execSync(`git tag -a v${nextVersion} -m "v${nextVersion}"`); + // execSync(`git push`); + // execSync(`git push origin v${nextVersion}`); + // consola.success(`Publish Successfully...`); + console.log(nextVersion); } resolvePublish();