improve action.yml

This commit is contained in:
Ryan Cao 2023-07-20 09:08:36 +08:00
parent ce803b732a
commit 00f4a8b31e
No known key found for this signature in database
3 changed files with 30 additions and 32 deletions

View file

@ -1,22 +1,26 @@
name: "attic" name: "attic-action"
author: "Ryan Cao"
description: "Cache Nix derivations with attic" description: "Cache Nix derivations with attic"
branding:
icon: "layers"
color: "blue"
inputs: inputs:
endpoint: endpoint:
description: "attic endpoint" description: "Attic endpoint"
required: true required: true
cache: cache:
description: "attic cache" description: "Attic cache name"
required: true required: true
skip-push: skip-push:
description: "set to true to disable pushing to the cache" description: "Disable pushing to the cache automatically"
required: false required: false
token: token:
description: "attic token" description: "Attic authorization token"
required: false required: false
runs: runs:
using: "node16" using: "node16"
main: "dist/index.js" main: "dist/index.js"
post: "dist/index.js" post: "dist/index.js"
post-if: "success()"

View file

@ -5,32 +5,27 @@
nixpkgs.url = "nixpkgs/nixos-unstable"; nixpkgs.url = "nixpkgs/nixos-unstable";
}; };
outputs = outputs = {nixpkgs, ...}: let
{ nixpkgs mkSystems = sys: builtins.map (arch: "${arch}-${sys}") ["x86_64" "aarch64"];
, ... systems =
}: mkSystems "linux"
let ++ mkSystems "darwin";
mkSystems = sys: builtins.map (arch: "${arch}-${sys}") [ "x86_64" "aarch64" ];
systems =
mkSystems "linux"
++ mkSystems "darwin";
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
forEachSystem = fn: forEachSystem = fn:
forAllSystems (s: fn nixpkgsFor.${s}); forAllSystems (s: fn nixpkgsFor.${s});
in in {
{ devShells = forEachSystem (pkgs: {
devShells = forEachSystem (pkgs: { default = pkgs.mkShell {
default = pkgs.mkShell { packages = with pkgs; [
packages = with pkgs; [ actionlint
actionlint nodePackages.pnpm
nodePackages.pnpm ];
]; };
}; });
});
formatter = forEachSystem (p: p.nixpkgs-fmt); formatter = forEachSystem (p: p.nixpkgs-fmt);
}; };
} }

View file

@ -6,7 +6,6 @@
"build": "esbuild src/index.ts --outdir=dist --platform=node --format=cjs --bundle --minify-whitespace --minify-syntax", "build": "esbuild src/index.ts --outdir=dist --platform=node --format=cjs --bundle --minify-whitespace --minify-syntax",
"format": "prettier --write ." "format": "prettier --write ."
}, },
"keywords": [],
"author": "Ryan Cao <hello@ryanccn.dev>", "author": "Ryan Cao <hello@ryanccn.dev>",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {