fix(ci): checkout release archive without git pack

This commit is contained in:
李启源
2026-08-13 22:03:57 +08:00
parent d349220395
commit c4cf993cf6
2 changed files with 8 additions and 9 deletions

View File

@@ -15,14 +15,13 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
server_url="${{ gitea.server_url }}" server_url="${{ gitea.server_url }}"
repository_url="${server_url%/}/${{ gitea.repository }}.git"
tag_name="${{ gitea.ref_name }}" tag_name="${{ gitea.ref_name }}"
git init . archive_url="${server_url%/}/api/v1/repos/${{ gitea.repository }}/archive/$tag_name.tar.gz"
git remote add origin "$repository_url" curl --fail --show-error --silent --location "$archive_url" --output source.tar.gz
# Gitea can return an invalid shallow pack for tag-only fetches. mkdir source
# Fetch the tag without depth limiting and force protocol v0 for compatibility. tar -xzf source.tar.gz --strip-components=1 -C source
git -c protocol.version=0 fetch --no-tags origin "refs/tags/$tag_name:refs/tags/$tag_name" cp -a source/. .
git checkout --detach "$tag_name^{commit}" rm -rf source source.tar.gz
- name: Set up pnpm - name: Set up pnpm
run: | run: |
@@ -216,7 +215,7 @@ jobs:
: "${RELEASE_TOKEN:?RELEASE_TOKEN is required}" : "${RELEASE_TOKEN:?RELEASE_TOKEN is required}"
server_url="${{ gitea.server_url }}" server_url="${{ gitea.server_url }}"
api_url="$server_url/api/v1/repos/${{ gitea.repository }}/releases" api_url="$server_url/api/v1/repos/${{ gitea.repository }}/releases"
target_commitish="$(git rev-parse HEAD)" target_commitish="$TAG_NAME"
node - "$TAG_NAME" "$PACKAGE_VERSION" "$target_commitish" "$IS_PRERELEASE" > release.json <<'NODE' node - "$TAG_NAME" "$PACKAGE_VERSION" "$target_commitish" "$IS_PRERELEASE" > release.json <<'NODE'
const [tagName, packageVersion, targetCommitish, prerelease] = process.argv.slice(2) const [tagName, packageVersion, targetCommitish, prerelease] = process.argv.slice(2)

View File

@@ -1,6 +1,6 @@
{ {
"name": "waveform-analysis", "name": "waveform-analysis",
"version": "0.1.34", "version": "0.1.35",
"main": "./dist/index.cjs", "main": "./dist/index.cjs",
"module": "./dist/index.js", "module": "./dist/index.js",
"types": "./dist/types/index.d.ts", "types": "./dist/types/index.d.ts",