From 509b984e701509d0dd0fd405b3e13fd193963180 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Fri, 5 Mar 2021 19:09:22 +0100 Subject: [PATCH] upload package --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++ tools/gen_workflow_yml.ts | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b988ebf43a..b0a74cc03f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,6 +67,20 @@ "name": "build-linux-release", "path": "target/release/deno\ntarget/release/denort" } + }, + { + "name": "Package", + "working-directory": "target/release", + "run": "zip -r deno-x86_64-unknown-linux-gnu.zip deno\nzip -r denort-x86_64-unknown-linux-gnu.zip denort\n./deno types > lib.deno.d.ts\ntar --exclude=.cargo_home --exclude=\".git*\" --exclude=target --exclude=third_party/prebuilt -czf target/release/deno_src.tar.gz -C .. deno" + }, + { + "name": "Upload package artifacts", + "uses": "actions/upload-artifact@v2", + "with": { + "name": "package", + "path": "target/release/deno-x86_64-unknown-linux-gnu.zip\ntarget/release/deno-x86_64-pc-windows-msvc.zip\ntarget/release/deno-x86_64-apple-darwin.zip\ntarget/release/denort-x86_64-unknown-linux-gnu.zip\ntarget/release/denort-x86_64-pc-windows-msvc.zip\ntarget/release/denort-x86_64-apple-darwin.zip\ntarget/release/deno_src.tar.gz\ntarget/release/lib.deno.d.ts", + "retention-days": 7 + } } ] }, @@ -197,6 +211,20 @@ "name": "build-macos-release", "path": "target/release/deno\ntarget/release/denort" } + }, + { + "name": "Package", + "working-directory": "target/release", + "run": "zip -r deno-x86_64-apple-darwin.zip deno\nzip -r denort-x86_64-apple-darwin.zip denort" + }, + { + "name": "Upload package artifacts", + "uses": "actions/upload-artifact@v2", + "with": { + "name": "package", + "path": "target/release/deno-x86_64-unknown-linux-gnu.zip\ntarget/release/deno-x86_64-pc-windows-msvc.zip\ntarget/release/deno-x86_64-apple-darwin.zip\ntarget/release/denort-x86_64-unknown-linux-gnu.zip\ntarget/release/denort-x86_64-pc-windows-msvc.zip\ntarget/release/denort-x86_64-apple-darwin.zip\ntarget/release/deno_src.tar.gz\ntarget/release/lib.deno.d.ts", + "retention-days": 7 + } } ] }, @@ -262,6 +290,20 @@ "name": "build-windows-release", "path": "target/release/deno.exe\ntarget/release/denort.exe" } + }, + { + "name": "Package", + "working-directory": "target/release", + "run": "Compress-Archive -CompressionLevel Optimal -Force -Path deno.exe -DestinationPath deno-x86_64-pc-windows-msvc.zip\nCompress-Archive -CompressionLevel Optimal -Force -Path denort.exe -DestinationPath denort-x86_64-pc-windows-msvc.zip" + }, + { + "name": "Upload package artifacts", + "uses": "actions/upload-artifact@v2", + "with": { + "name": "package", + "path": "target/release/deno-x86_64-unknown-linux-gnu.zip\ntarget/release/deno-x86_64-pc-windows-msvc.zip\ntarget/release/deno-x86_64-apple-darwin.zip\ntarget/release/denort-x86_64-unknown-linux-gnu.zip\ntarget/release/denort-x86_64-pc-windows-msvc.zip\ntarget/release/denort-x86_64-apple-darwin.zip\ntarget/release/deno_src.tar.gz\ntarget/release/lib.deno.d.ts", + "retention-days": 7 + } } ] } diff --git a/tools/gen_workflow_yml.ts b/tools/gen_workflow_yml.ts index 3921d053c3..6e9a71e418 100644 --- a/tools/gen_workflow_yml.ts +++ b/tools/gen_workflow_yml.ts @@ -13,6 +13,12 @@ const fastRunners = { "windows": "windows-2019", }; +const targets = { + "linux": "x86_64-unknown-linux-gnu", + "macos": "x86_64-apple-darwin", + "windows": "denort-x86_64-pc-windows-msvc", +}; + const env = { "CARGO_INCREMENTAL": "0", "RUST_BACKTRACE": "full", @@ -73,6 +79,44 @@ function generateBuildJobs(): Record { for (const kind of kinds) { if (os != "linux" && kind == "debug") continue; + const packageStep = { + name: "Package", + "working-directory": "target/release", + run: (os == "windows" + ? [ + "Compress-Archive -CompressionLevel Optimal -Force -Path deno.exe -DestinationPath deno-x86_64-pc-windows-msvc.zip", + "Compress-Archive -CompressionLevel Optimal -Force -Path denort.exe -DestinationPath denort-x86_64-pc-windows-msvc.zip", + ] + : [ + `zip -r deno-${targets[os]}.zip deno`, + `zip -r denort-${targets[os]}.zip denort`, + ...(os == "linux" + ? [ + "./deno types > lib.deno.d.ts", + `tar --exclude=.cargo_home --exclude=".git*" --exclude=target --exclude=third_party/prebuilt -czf target/release/deno_src.tar.gz -C .. deno`, + ] + : []), + ]).join("\n"), + }; + const uploadPackageStep = { + name: "Upload package artifacts", + uses: "actions/upload-artifact@v2", + with: { + name: "package", + path: [ + "target/release/deno-x86_64-unknown-linux-gnu.zip", + "target/release/deno-x86_64-pc-windows-msvc.zip", + "target/release/deno-x86_64-apple-darwin.zip", + "target/release/denort-x86_64-unknown-linux-gnu.zip", + "target/release/denort-x86_64-pc-windows-msvc.zip", + "target/release/denort-x86_64-apple-darwin.zip", + "target/release/deno_src.tar.gz", + "target/release/lib.deno.d.ts", + ].join("\n"), + "retention-days": 7, + }, + }; + jobs[`build_${os}_${kind}`] = { name: `build / ${os} / ${kind}`, "runs-on": fastRunners[os], @@ -110,6 +154,7 @@ function generateBuildJobs(): Record { ].join("\n"), }, }, + ...(kind == "release" ? [packageStep, uploadPackageStep] : []), ], }; }