From d7203092039d3c46ca8480ff8eecf612deb2b2f6 Mon Sep 17 00:00:00 2001 From: Ry Dahl Date: Fri, 17 Jan 2020 17:53:13 -0500 Subject: Auto cargo-publish on tags (#3704) fix tools/cargo_publish.py --- .github/workflows/ci.yml | 9 +++++++++ tools/cargo_publish.py | 28 ++++++++++++++++++++++++++++ tools/cargo_publish_others.py | 30 ------------------------------ 3 files changed, 37 insertions(+), 30 deletions(-) create mode 100755 tools/cargo_publish.py delete mode 100755 tools/cargo_publish_others.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48d86e5c4..28b8bc300 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,5 +186,14 @@ jobs: target/release/deno_src.tar.gz draft: true + - name: Publish + if: > + startsWith(github.ref, 'refs/tags/') && + github.repository == 'denoland/deno' && + runner.os == 'Linux' + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: ./tools/cargo_publish.py + - name: Stop sccache run: sccache --stop-server diff --git a/tools/cargo_publish.py b/tools/cargo_publish.py new file mode 100755 index 000000000..b8fa1f037 --- /dev/null +++ b/tools/cargo_publish.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import os +import sys +import argparse +from util import run, root_path + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--dry-run", action="store_true") + args = parser.parse_args() + + cargo_publish = ["cargo", "publish"] + if args.dry_run: + cargo_publish += ["--dry-run"] + + os.chdir(os.path.join(root_path, "core")) + run(cargo_publish) + + os.chdir(os.path.join(root_path, "deno_typescript")) + run(cargo_publish) + + os.chdir(os.path.join(root_path, "cli")) + run(cargo_publish) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/cargo_publish_others.py b/tools/cargo_publish_others.py deleted file mode 100755 index 83b9b50e2..000000000 --- a/tools/cargo_publish_others.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# Publishes 'deno_cli', 'deno_cli_snapshots', and 'deno_typescript' crates. -# DOES NOT PUBLISH 'deno' crate see tools/cargo_package.py for that. - -import os -import sys -import argparse -from util import run, root_path - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("--dry-run", action="store_true") - args = parser.parse_args() - - cargo_publish = ["cargo", "publish"] - if args.dry_run: - cargo_publish += ["--dry-run"] - - # Publish the deno_typescript crate. - os.chdir(os.path.join(root_path, "deno_typescript")) - run(cargo_publish) - - # Publish the deno_cli crate. - os.chdir(os.path.join(root_path, "cli")) - run(cargo_publish) - - -if __name__ == '__main__': - sys.exit(main()) -- cgit v1.2.3