diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3eded39..0f0ce82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,15 +125,25 @@ jobs: - name: Download all artifacts uses: actions/download-artifact@v4 - - name: Create release + - name: Create or update release env: GH_TOKEN: ${{ github.token }} TAG_NAME: ${{ github.ref_name }} run: | - gh release create "$TAG_NAME" \ - macos-arm64/wick-darwin-arm64.tar.gz \ - macos-arm64/wick-captcha-darwin-arm64.tar.gz \ - linux-amd64/wick-linux-amd64.tar.gz \ - linux-amd64/wick-linux-amd64.deb \ - --title "$TAG_NAME" \ - --generate-notes + if gh release view "$TAG_NAME" > /dev/null 2>&1; then + echo "Release $TAG_NAME exists, uploading assets..." + gh release upload "$TAG_NAME" --clobber \ + macos-arm64/wick-darwin-arm64.tar.gz \ + macos-arm64/wick-captcha-darwin-arm64.tar.gz \ + linux-amd64/wick-linux-amd64.tar.gz \ + linux-amd64/wick-linux-amd64.deb + else + echo "Creating release $TAG_NAME..." + gh release create "$TAG_NAME" \ + macos-arm64/wick-darwin-arm64.tar.gz \ + macos-arm64/wick-captcha-darwin-arm64.tar.gz \ + linux-amd64/wick-linux-amd64.tar.gz \ + linux-amd64/wick-linux-amd64.deb \ + --title "$TAG_NAME" \ + --generate-notes + fi diff --git a/npm/package.json b/npm/package.json index e411d25..deb3624 100644 --- a/npm/package.json +++ b/npm/package.json @@ -16,8 +16,8 @@ "scripts": { "postinstall": "node scripts/install.js" }, - "os": ["darwin"], - "cpu": ["arm64"], + "os": ["darwin", "linux"], + "cpu": ["arm64", "x64"], "files": [ "bin/", "scripts/", diff --git a/npm/scripts/install.js b/npm/scripts/install.js index d853144..c2a4275 100644 --- a/npm/scripts/install.js +++ b/npm/scripts/install.js @@ -11,6 +11,11 @@ const ASSETS = { url: `https://github.com/wickproject/wick/releases/download/v${VERSION}/wick-${VERSION}-darwin-arm64.tar.gz`, sha256: "766f48f0eb1cfb220352f9fb266fb97504fe456cea9670a1d1f3516b3ae8f725", }, + "linux-x64": { + url: `https://github.com/wickproject/wick/releases/download/v${VERSION}/wick-linux-amd64.tar.gz`, + sha256: "110d074072ff5fb334ca3d0123def3f9463d5298f9c6a48fa727a03d21f08ea9", + hasLib: true, + }, }; const asset = ASSETS[PLATFORM]; @@ -61,6 +66,20 @@ async function main() { execFileSync("tar", ["xzf", tarPath, "-C", binDir]); fs.unlinkSync(tarPath); fs.chmodSync(binPath, 0o755); + + // On Linux, the tarball includes libcronet.so — create a wrapper script + // so LD_LIBRARY_PATH is set automatically + const libPath = path.join(binDir, "libcronet.so"); + if (asset.hasLib && fs.existsSync(libPath)) { + const realBin = path.join(binDir, "wick-bin"); + fs.renameSync(binPath, realBin); + fs.writeFileSync( + binPath, + `#!/bin/sh\nLD_LIBRARY_PATH="${binDir}:$LD_LIBRARY_PATH" exec "${realBin}" "$@"\n` + ); + fs.chmodSync(binPath, 0o755); + } + console.log("Wick installed successfully."); }