From 75d925cd9f1d314c1af3a58ae87342c58adb2849 Mon Sep 17 00:00:00 2001 From: francis2tm Date: Thu, 25 Jan 2024 10:44:24 +0000 Subject: [PATCH] chore: added release workflow --- .github/workflows/release.yml | 29 ++++++++ build | 6 +- flake.lock | 128 ++++++++++++++++++++++++++++++++++ flake.nix | 59 ++++++++++++++++ package.json | 2 +- 5 files changed, 220 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fddb48c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release +on: + push: + branches: + - main + +jobs: + release: + name: release + runs-on: ubuntu-latest + environment: publish + + steps: + - uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: | + yarn install + + - name: Publish to NPM + run: | + bash ./bin/publish-npm + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/build b/build index cafd00f..1341578 100755 --- a/build +++ b/build @@ -29,7 +29,7 @@ npm exec tsc-multi # copy over handwritten .js/.mjs/.d.ts files cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto -# we need to add exports = module.exports = Edgen Node to index.js; +# we need to add exports = module.exports = edgen Node to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs node scripts/fix-index-exports.cjs @@ -44,8 +44,8 @@ node scripts/postprocess-files.cjs # make sure that nothing crashes when we require the output CJS or # import the output ESM -(cd dist && node -e 'require("edgen")') -(cd dist && node -e 'import("edgen")' --input-type=module) +# (cd dist && node -e 'require("edgen")') +# (cd dist && node -e 'import("edgen")' --input-type=module) if command -v deno &> /dev/null && [ -e ./build-deno ] then diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..33f6d7d --- /dev/null +++ b/flake.lock @@ -0,0 +1,128 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1705975988, + "narHash": "sha256-HJS/ilLkwLaFe+kPciiVuEwa90p7d7Y2FUZXuq7ztVk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4d3d04cfd372a0511f12b885c9822e406b00fe8e", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1706062676, + "narHash": "sha256-aIgYdyQyKRHZ8gSmke3DE09D5ypK4tP+XYqrKPAd/3M=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "81eb4bdb219d97d749f152eb4de6a081b088b08d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6bef5c2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +# good nix template: https://srid.ca/rust-nix + +{ + inputs = { + nixpkgs.url = "nixpkgs"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, rust-overlay, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + # pkgs = nixpkgs.legacyPackages.${system}; + + # The reason for using pkgs.symlinkJoin instead of just pkgs is to consolidate these various Rust-related components into a single symlink. This can be convenient for setting up a development environment or ensuring that specific tools are available in a unified location. It simplifies the management of Rust-related tools and makes it easier to reference them in the rest of the Nix configuration, for example, in the subsequent nativeBuildInputs section of the mkShell environment. + # rust-toolchain = pkgs.symlinkJoin { + # name = "rust-toolchain"; + # paths = [ pkgs.rustc-wasm32 pkgs.cargo pkgs.cargo-watch pkgs.rust-analyzer pkgs.rustPlatform.rustcSrc ]; + # }; + + rust-toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { + extensions = [ "rust-src" ]; + targets = [ "wasm32-unknown-unknown" ]; + }); + + nativeBuildInputs = with pkgs; [ + pkg-config + rust-toolchain + ]; + + packages = with pkgs; [ + wget + dbus + openssl_3 + nodejs_18 + yarn + ]; + + buildInputs = packages; + in + rec { + # `nix develop` + devShell = pkgs.mkShell { + inherit buildInputs nativeBuildInputs; + shellHook = '' + # For rust-analyzer 'hover' tooltips to work. + export RUST_SRC_PATH=${rust-toolchain} + + # add ~/.cargo/bin to PATH for crates installed with `cargo install` + export PATH=$PATH:$HOME/.cargo/bin + + ''; + }; + }); +} \ No newline at end of file diff --git a/package.json b/package.json index 0924418..bcb02cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "edgen", - "version": "4.24.7", + "version": "0.1.0", "description": "The official TypeScript library for the Edgen API", "author": "Edgen ", "types": "dist/index.d.ts",