Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
chore: added release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
francis2tm committed Jan 25, 2024
1 parent eb591bf commit 75d925c
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 4 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 3 additions & 3 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
128 changes: 128 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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
'';
};
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 75d925c

Please sign in to comment.