diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b094b12..2dd3459 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,7 +1,6 @@ name: check on: - push: pull_request: jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8fc65b..8c479fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,54 +1,65 @@ name: Release - env: PACKAGE_NAME: "mcp-server-drupal" TARGET_LIST: "x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-msvc,x86_64-apple-darwin,aarch64-apple-darwin" - on: push: tags: - "v*.*.*" - permissions: contents: write id-token: write - jobs: build-and-sign: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Deno uses: denoland/setup-deno@v2 with: deno-version: "2.x" - - name: Extract version from tag run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - - name: Setup cosign uses: sigstore/cosign-installer@v3.7.0 - - name: Build the binaries run: | for target in $(echo $TARGET_LIST | tr "," "\n") do - binary_name=$(echo $target | sed "s/^deno-/$PACKAGE_NAME-/" | sed "s/-/_/g") - deno compile --target=$target --output=./build/$binary_name ./src/index.ts - done + arch=$(echo $target | cut -d'-' -f1) + os=$(echo $target | cut -d'-' -f2) + + case $arch in + "x86_64") arch_name="x86" ;; + "aarch64") arch_name="arm" ;; + *) arch_name=$arch ;; + esac + + case $os in + "apple") os_name="darwin" ;; + "unknown") os_name="linux" ;; + "pc") os_name="windows" ;; + *) os_name=$os ;; + esac + + binary_name="${PACKAGE_NAME}_${os_name}_${arch_name}" - - name: Sign binaries with Sigstore Keyless + deno task build --target=$target --output=./build/$binary_name + done + - name: Sign binaries run: | - for file in build/* - do - cosign sign-blob - \ --yes - \ build/$file - \ --bundle build/$file.sigstore + mkdir -p build/bundles + + for file in build/*; do + if [[ "$file" == "build/bundles" ]]; then continue; fi + base_name=$(basename "$file" .exe) + cosign sign-blob --bundle "build/bundles/${base_name}.bundle" --yes "$file" done + cd build/bundles + tar -czf ../signatures.tar.gz * + cd ../.. - name: Release uses: softprops/action-gh-release@v2 with: diff --git a/deno.jsonc b/deno.jsonc index e1ba990..78c0581 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -6,7 +6,7 @@ "lint": "deno lint", "build": "deno run --allow-read --allow-net --allow-env --allow-run scripts/build.ts", "inspector": "npx @modelcontextprotocol/inspector build/mcp-server-drupal", - "release": "deno run npm:release-it" + "release": "deno run -A npm:release-it" }, "compilerOptions": { "strict": true, @@ -23,7 +23,6 @@ "@std/fmt": "jsr:@std/fmt@^1.0.3", "@std/fs": "jsr:@std/fs@^1.0.8", "@std/path": "jsr:@std/path@^1.0.8", - "release-it": "npm:release-it@^18.0.0", "zod": "npm:zod@^3.24.1" } } diff --git a/deno.lock b/deno.lock index 58b9ef9..bb74336 100644 --- a/deno.lock +++ b/deno.lock @@ -9,7 +9,7 @@ "jsr:@std/internal@^1.0.5": "1.0.5", "jsr:@std/path@^1.0.8": "1.0.8", "npm:@modelcontextprotocol/sdk@^1.0.4": "1.0.4", - "npm:release-it@18": "18.0.0", + "npm:release-it@*": "18.0.0", "npm:zod@^3.24.1": "3.24.1" }, "jsr": { @@ -1561,7 +1561,6 @@ "jsr:@std/fs@^1.0.8", "jsr:@std/path@^1.0.8", "npm:@modelcontextprotocol/sdk@^1.0.4", - "npm:release-it@18", "npm:zod@^3.24.1" ] }