mirror of
https://github.com/ryanccn/attic-action.git
synced 2024-11-24 16:34:22 +00:00
Automatic compilation
This commit is contained in:
parent
a9de6744a1
commit
7d3225d76d
19 changed files with 29 additions and 679 deletions
30
.github/workflows/release.yml
vendored
30
.github/workflows/release.yml
vendored
|
@ -1,30 +0,0 @@
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published, edited]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.release.tag_name }}
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
cache: pnpm
|
|
||||||
cache-dependency-path: pnpm-lock.yaml
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: pnpm install && pnpm build
|
|
||||||
|
|
||||||
- uses: JasonEtco/build-and-tag-action@v2
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
41
.github/workflows/test.yml
vendored
41
.github/workflows/test.yml
vendored
|
@ -1,41 +0,0 @@
|
||||||
name: "Test"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["main"]
|
|
||||||
workflow_call:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-cache:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v2
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
cache: pnpm
|
|
||||||
cache-dependency-path: pnpm-lock.yaml
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: pnpm install && pnpm build
|
|
||||||
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v22
|
|
||||||
|
|
||||||
- name: Setup Attic Cache
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
endpoint: ${{ secrets.ATTIC_ENDPOINT }}
|
|
||||||
cache: ${{ secrets.ATTIC_CACHE }}
|
|
||||||
token: ${{ secrets.ATTIC_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build Nix Package
|
|
||||||
run: nix build -f test.nix
|
|
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,8 +0,0 @@
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
node_modules/
|
|
||||||
|
|
||||||
# nix
|
|
||||||
.direnv/
|
|
||||||
.envrc
|
|
||||||
result*
|
|
|
@ -1 +0,0 @@
|
||||||
16
|
|
|
@ -1,4 +0,0 @@
|
||||||
.direnv/
|
|
||||||
dist/
|
|
||||||
|
|
||||||
pnpm-lock.yaml
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"useTabs": true,
|
|
||||||
"printWidth": 120
|
|
||||||
}
|
|
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 Ryan Cao
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
29
dist/index.js
vendored
Normal file
29
dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
flake.lock
26
flake.lock
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689534811,
|
|
||||||
"narHash": "sha256-jnSUdzD/414d94plCyNlvTJJtiTogTep6t7ZgIKIHiE=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "6cee3b5893090b0f5f0a06b4cf42ca4e60e5d222",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
36
flake.nix
36
flake.nix
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
description = "";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs =
|
|
||||||
{ nixpkgs
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
mkSystems = sys: builtins.map (arch: "${arch}-${sys}") [ "x86_64" "aarch64" ];
|
|
||||||
systems =
|
|
||||||
mkSystems "linux"
|
|
||||||
++ mkSystems "darwin";
|
|
||||||
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
|
||||||
|
|
||||||
forEachSystem = fn:
|
|
||||||
forAllSystems (s: fn nixpkgsFor.${s});
|
|
||||||
in
|
|
||||||
{
|
|
||||||
devShells = forEachSystem (pkgs: {
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
packages = with pkgs; [
|
|
||||||
actionlint
|
|
||||||
nodePackages.pnpm
|
|
||||||
];
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
formatter = forEachSystem (p: p.nixpkgs-fmt);
|
|
||||||
};
|
|
||||||
}
|
|
24
package.json
24
package.json
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@ryanccn/attic-action",
|
|
||||||
"main": "dist/index.js",
|
|
||||||
"description": "Cache Nix derivations with attic",
|
|
||||||
"scripts": {
|
|
||||||
"build": "esbuild src/index.ts --outdir=dist --platform=node --format=cjs --bundle --minify-whitespace --minify-syntax",
|
|
||||||
"format": "prettier --write ."
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": "Ryan Cao <hello@ryanccn.dev>",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/core": "^1.10.0",
|
|
||||||
"@actions/exec": "^1.1.1",
|
|
||||||
"ofetch": "^1.1.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^16.18.38",
|
|
||||||
"esbuild": "^0.18.14",
|
|
||||||
"prettier": "3.0.0",
|
|
||||||
"typescript": "^5.1.6"
|
|
||||||
},
|
|
||||||
"packageManager": "pnpm@8.6.9"
|
|
||||||
}
|
|
329
pnpm-lock.yaml
329
pnpm-lock.yaml
|
@ -1,329 +0,0 @@
|
||||||
lockfileVersion: '6.0'
|
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
'@actions/core':
|
|
||||||
specifier: ^1.10.0
|
|
||||||
version: 1.10.0
|
|
||||||
'@actions/exec':
|
|
||||||
specifier: ^1.1.1
|
|
||||||
version: 1.1.1
|
|
||||||
ofetch:
|
|
||||||
specifier: ^1.1.1
|
|
||||||
version: 1.1.1
|
|
||||||
|
|
||||||
devDependencies:
|
|
||||||
'@types/node':
|
|
||||||
specifier: ^16.18.38
|
|
||||||
version: 16.18.38
|
|
||||||
esbuild:
|
|
||||||
specifier: ^0.18.14
|
|
||||||
version: 0.18.14
|
|
||||||
prettier:
|
|
||||||
specifier: 3.0.0
|
|
||||||
version: 3.0.0
|
|
||||||
typescript:
|
|
||||||
specifier: ^5.1.6
|
|
||||||
version: 5.1.6
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
/@actions/core@1.10.0:
|
|
||||||
resolution: {integrity: sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==}
|
|
||||||
dependencies:
|
|
||||||
'@actions/http-client': 2.1.0
|
|
||||||
uuid: 8.3.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@actions/exec@1.1.1:
|
|
||||||
resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==}
|
|
||||||
dependencies:
|
|
||||||
'@actions/io': 1.1.3
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@actions/http-client@2.1.0:
|
|
||||||
resolution: {integrity: sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==}
|
|
||||||
dependencies:
|
|
||||||
tunnel: 0.0.6
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@actions/io@1.1.3:
|
|
||||||
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@esbuild/android-arm64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-rZ2v+Luba5/3D6l8kofWgTnqE+qsC/L5MleKIKFyllHTKHrNBMqeRCnZI1BtRx8B24xMYxeU32iIddRQqMsOsg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/android-arm@0.18.14:
|
|
||||||
resolution: {integrity: sha512-blODaaL+lngG5bdK/t4qZcQvq2BBqrABmYwqPPcS5VRxrCSGHb9R/rA3fqxh7R18I7WU4KKv+NYkt22FDfalcg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/android-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-qSwh8y38QKl+1Iqg+YhvCVYlSk3dVLk9N88VO71U4FUjtiSFylMWK3Ugr8GC6eTkkP4Tc83dVppt2n8vIdlSGg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/darwin-arm64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-9Hl2D2PBeDYZiNbnRKRWuxwHa9v5ssWBBjisXFkVcSP5cZqzZRFBUWEQuqBHO4+PKx4q4wgHoWtfQ1S7rUqJ2Q==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/darwin-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-ZnI3Dg4ElQ6tlv82qLc/UNHtFsgZSKZ7KjsUNAo1BF1SoYDjkGKHJyCrYyWjFecmXpvvG/KJ9A/oe0H12odPLQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/freebsd-arm64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-h3OqR80Da4oQCIa37zl8tU5MwHQ7qgPV0oVScPfKJK21fSRZEhLE4IIVpmcOxfAVmqjU6NDxcxhYaM8aDIGRLw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [freebsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/freebsd-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-ha4BX+S6CZG4BoH9tOZTrFIYC1DH13UTCRHzFc3GWX74nz3h/N6MPF3tuR3XlsNjMFUazGgm35MPW5tHkn2lzQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [freebsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-arm64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-IXORRe22In7U65NZCzjwAUc03nn8SDIzWCnfzJ6t/8AvGx5zBkcLfknI+0P+hhuftufJBmIXxdSTbzWc8X/V4w==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-arm@0.18.14:
|
|
||||||
resolution: {integrity: sha512-5+7vehI1iqru5WRtJyU2XvTOvTGURw3OZxe3YTdE9muNNIdmKAVmSHpB3Vw2LazJk2ifEdIMt/wTWnVe5V98Kg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-ia32@0.18.14:
|
|
||||||
resolution: {integrity: sha512-BfHlMa0nibwpjG+VXbOoqJDmFde4UK2gnW351SQ2Zd4t1N3zNdmUEqRkw/srC1Sa1DRBE88Dbwg4JgWCbNz/FQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ia32]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-loong64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-j2/Ex++DRUWIAaUDprXd3JevzGtZ4/d7VKz+AYDoHZ3HjJzCyYBub9CU1wwIXN+viOP0b4VR3RhGClsvyt/xSw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [loong64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-mips64el@0.18.14:
|
|
||||||
resolution: {integrity: sha512-qn2+nc+ZCrJmiicoAnJXJJkZWt8Nwswgu1crY7N+PBR8ChBHh89XRxj38UU6Dkthl2yCVO9jWuafZ24muzDC/A==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [mips64el]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-ppc64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-aGzXzd+djqeEC5IRkDKt3kWzvXoXC6K6GyYKxd+wsFJ2VQYnOWE954qV2tvy5/aaNrmgPTb52cSCHFE+Z7Z0yg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ppc64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-riscv64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-8C6vWbfr0ygbAiMFLS6OPz0BHvApkT2gCboOGV76YrYw+sD/MQJzyITNsjZWDXJwPu9tjrFQOVG7zijRzBCnLw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [riscv64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-s390x@0.18.14:
|
|
||||||
resolution: {integrity: sha512-G/Lf9iu8sRMM60OVGOh94ZW2nIStksEcITkXdkD09/T6QFD/o+g0+9WVyR/jajIb3A0LvBJ670tBnGe1GgXMgw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [s390x]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-TBgStYBQaa3EGhgqIDM+ECnkreb0wkcKqL7H6m+XPcGUoU4dO7dqewfbm0mWEQYH3kzFHrzjOFNpSAVzDZRSJw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/netbsd-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-stvCcjyCQR2lMTroqNhAbvROqRjxPEq0oQ380YdXxA81TaRJEucH/PzJ/qsEtsHgXlWFW6Ryr/X15vxQiyRXVg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [netbsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/openbsd-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-apAOJF14CIsN5ht1PA57PboEMsNV70j3FUdxLmA2liZ20gEQnfTG5QU0FhENo5nwbTqCB2O3WDsXAihfODjHYw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [openbsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/sunos-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-fYRaaS8mDgZcGybPn2MQbn1ZNZx+UXFSUoS5Hd2oEnlsyUcr/l3c6RnXf1bLDRKKdLRSabTmyCy7VLQ7VhGdOQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [sunos]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/win32-arm64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-1c44RcxKEJPrVj62XdmYhxXaU/V7auELCmnD+Ri+UCt+AGxTvzxl9uauQhrFso8gj6ZV1DaORV0sT9XSHOAk8Q==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/win32-ia32@0.18.14:
|
|
||||||
resolution: {integrity: sha512-EXAFttrdAxZkFQmpvcAQ2bywlWUsONp/9c2lcfvPUhu8vXBBenCXpoq9YkUvVP639ld3YGiYx0YUQ6/VQz3Maw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ia32]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/win32-x64@0.18.14:
|
|
||||||
resolution: {integrity: sha512-K0QjGbcskx+gY+qp3v4/940qg8JitpXbdxFhRDA1aYoNaPff88+aEwoq45aqJ+ogpxQxmU0ZTjgnrQD/w8iiUg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@types/node@16.18.38:
|
|
||||||
resolution: {integrity: sha512-6sfo1qTulpVbkxECP+AVrHV9OoJqhzCsfTNp5NIG+enM4HyM3HvZCO798WShIXBN0+QtDIcutJCjsVYnQP5rIQ==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/destr@2.0.0:
|
|
||||||
resolution: {integrity: sha512-FJ9RDpf3GicEBvzI3jxc2XhHzbqD8p4ANw/1kPsFBfTvP1b7Gn/Lg1vO7R9J4IVgoMbyUmFrFGZafJ1hPZpvlg==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/esbuild@0.18.14:
|
|
||||||
resolution: {integrity: sha512-uNPj5oHPYmj+ZhSQeYQVFZ+hAlJZbAGOmmILWIqrGvPVlNLbyOvU5Bu6Woi8G8nskcx0vwY0iFoMPrzT86Ko+w==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
hasBin: true
|
|
||||||
requiresBuild: true
|
|
||||||
optionalDependencies:
|
|
||||||
'@esbuild/android-arm': 0.18.14
|
|
||||||
'@esbuild/android-arm64': 0.18.14
|
|
||||||
'@esbuild/android-x64': 0.18.14
|
|
||||||
'@esbuild/darwin-arm64': 0.18.14
|
|
||||||
'@esbuild/darwin-x64': 0.18.14
|
|
||||||
'@esbuild/freebsd-arm64': 0.18.14
|
|
||||||
'@esbuild/freebsd-x64': 0.18.14
|
|
||||||
'@esbuild/linux-arm': 0.18.14
|
|
||||||
'@esbuild/linux-arm64': 0.18.14
|
|
||||||
'@esbuild/linux-ia32': 0.18.14
|
|
||||||
'@esbuild/linux-loong64': 0.18.14
|
|
||||||
'@esbuild/linux-mips64el': 0.18.14
|
|
||||||
'@esbuild/linux-ppc64': 0.18.14
|
|
||||||
'@esbuild/linux-riscv64': 0.18.14
|
|
||||||
'@esbuild/linux-s390x': 0.18.14
|
|
||||||
'@esbuild/linux-x64': 0.18.14
|
|
||||||
'@esbuild/netbsd-x64': 0.18.14
|
|
||||||
'@esbuild/openbsd-x64': 0.18.14
|
|
||||||
'@esbuild/sunos-x64': 0.18.14
|
|
||||||
'@esbuild/win32-arm64': 0.18.14
|
|
||||||
'@esbuild/win32-ia32': 0.18.14
|
|
||||||
'@esbuild/win32-x64': 0.18.14
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/node-fetch-native@1.2.0:
|
|
||||||
resolution: {integrity: sha512-5IAMBTl9p6PaAjYCnMv5FmqIF6GcZnawAVnzaCG0rX2aYZJ4CxEkZNtVPuTRug7fL7wyM5BQYTlAzcyMPi6oTQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ofetch@1.1.1:
|
|
||||||
resolution: {integrity: sha512-SSMoktrp9SNLi20BWfB/BnnKcL0RDigXThD/mZBeQxkIRv1xrd9183MtLdsqRYLYSqW0eTr5t8w8MqjNhvoOQQ==}
|
|
||||||
dependencies:
|
|
||||||
destr: 2.0.0
|
|
||||||
node-fetch-native: 1.2.0
|
|
||||||
ufo: 1.1.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/prettier@3.0.0:
|
|
||||||
resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==}
|
|
||||||
engines: {node: '>=14'}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tunnel@0.0.6:
|
|
||||||
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
|
||||||
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/typescript@5.1.6:
|
|
||||||
resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==}
|
|
||||||
engines: {node: '>=14.17'}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/ufo@1.1.2:
|
|
||||||
resolution: {integrity: sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/uuid@8.3.2:
|
|
||||||
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
|
||||||
hasBin: true
|
|
||||||
dev: false
|
|
18
src/index.ts
18
src/index.ts
|
@ -1,18 +0,0 @@
|
||||||
import { install } from "./stages/install";
|
|
||||||
import { configure } from "./stages/configure";
|
|
||||||
import { push } from "./stages/push.ts";
|
|
||||||
import { getState, saveState } from "@actions/core";
|
|
||||||
|
|
||||||
const isPost = !!getState("isPost");
|
|
||||||
|
|
||||||
const main = async () => {
|
|
||||||
await install();
|
|
||||||
await configure();
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!isPost) {
|
|
||||||
saveState("isPost", true);
|
|
||||||
main();
|
|
||||||
} else {
|
|
||||||
push();
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
import * as core from "@actions/core";
|
|
||||||
import { exec } from "@actions/exec";
|
|
||||||
import { getStorePaths } from "../utils";
|
|
||||||
|
|
||||||
export const configure = async () => {
|
|
||||||
core.startGroup("Configure attic");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const endpoint = core.getInput("endpoint");
|
|
||||||
const cache = core.getInput("cache");
|
|
||||||
const token = core.getInput("token");
|
|
||||||
|
|
||||||
core.info("Logging in to attic cache");
|
|
||||||
await exec("attic", ["login", "--set-default", cache, endpoint, token]);
|
|
||||||
|
|
||||||
core.info("Collecting store paths before build");
|
|
||||||
const paths = await getStorePaths();
|
|
||||||
core.saveState("initial-paths", JSON.stringify(paths));
|
|
||||||
} catch (e) {
|
|
||||||
core.setFailed(`Action failed with error: ${e}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
core.endGroup();
|
|
||||||
};
|
|
|
@ -1,36 +0,0 @@
|
||||||
import * as core from "@actions/core";
|
|
||||||
import { exec } from "@actions/exec";
|
|
||||||
import { fetch } from "ofetch";
|
|
||||||
|
|
||||||
import { writeFile } from "node:fs/promises";
|
|
||||||
import { tmpdir } from "node:os";
|
|
||||||
import { join } from "node:path";
|
|
||||||
|
|
||||||
export const install = async () => {
|
|
||||||
core.startGroup("Install attic");
|
|
||||||
|
|
||||||
core.info("Installing attic");
|
|
||||||
const installScript = await fetch(
|
|
||||||
"https://raw.githubusercontent.com/zhaofengli/attic/main/.github/install-attic-ci.sh",
|
|
||||||
).then((r) => {
|
|
||||||
if (!r.ok) {
|
|
||||||
core.setFailed(`Action failed with error: ${r.statusText}`);
|
|
||||||
core.endGroup();
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r.text();
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const installScriptPath = join(tmpdir(), "install-attic-ci.sh");
|
|
||||||
|
|
||||||
await writeFile(installScriptPath, installScript);
|
|
||||||
core.info("Running install script");
|
|
||||||
await exec("bash", [installScriptPath]);
|
|
||||||
} catch (e) {
|
|
||||||
core.setFailed(`Action failed with error: ${e}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
core.endGroup();
|
|
||||||
};
|
|
|
@ -1,31 +0,0 @@
|
||||||
import * as core from "@actions/core";
|
|
||||||
import { exec } from "@actions/exec";
|
|
||||||
import { getStorePaths } from "../utils";
|
|
||||||
|
|
||||||
export const push = async () => {
|
|
||||||
core.startGroup("Push to Attic");
|
|
||||||
|
|
||||||
try {
|
|
||||||
const skipPush = core.getInput("skip-push");
|
|
||||||
if (skipPush === "true") {
|
|
||||||
core.info("Pushing to cache is disabled by skip-push");
|
|
||||||
} else {
|
|
||||||
const cache = core.getInput("cache");
|
|
||||||
|
|
||||||
core.info("Pushing to cache");
|
|
||||||
const oldPaths = JSON.parse(core.getState("initial-paths")) as string[];
|
|
||||||
const newPaths = await getStorePaths();
|
|
||||||
const addedPaths = newPaths
|
|
||||||
.filter((p) => !oldPaths.includes(p))
|
|
||||||
.filter(
|
|
||||||
(p) => !p.endsWith(".drv") && !p.endsWith(".drv.chroot") && !p.endsWith(".check") && !p.endsWith(".lock"),
|
|
||||||
);
|
|
||||||
|
|
||||||
await exec("attic", ["push", cache, ...addedPaths]);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
core.setFailed(`Action failed with error: ${e}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
core.endGroup();
|
|
||||||
};
|
|
23
src/utils.ts
23
src/utils.ts
|
@ -1,23 +0,0 @@
|
||||||
import { exec } from "@actions/exec";
|
|
||||||
import { Writable } from "node:stream";
|
|
||||||
|
|
||||||
class StringStream extends Writable {
|
|
||||||
chunks: Buffer[] = [];
|
|
||||||
|
|
||||||
_write(chunk: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>, _enc: unknown, next: () => unknown) {
|
|
||||||
this.chunks.push(Buffer.from(chunk));
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
|
|
||||||
string() {
|
|
||||||
return Buffer.concat(this.chunks).toString("utf-8");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getStorePaths = async () => {
|
|
||||||
const outStream = new StringStream();
|
|
||||||
await exec("nix", ["path-info", "--all"], { outStream });
|
|
||||||
const paths = outStream.string().split("\n").filter(Boolean);
|
|
||||||
|
|
||||||
return paths;
|
|
||||||
};
|
|
7
test.nix
7
test.nix
|
@ -1,7 +0,0 @@
|
||||||
let
|
|
||||||
pkgs = import <nixpkgs> { };
|
|
||||||
time = with builtins; toString currentTime;
|
|
||||||
in
|
|
||||||
pkgs.runCommand "${time}-test" { } ''
|
|
||||||
echo "${time}" > $out
|
|
||||||
''
|
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"strict": true,
|
|
||||||
"downlevelIteration": true,
|
|
||||||
"module": "esnext",
|
|
||||||
"target": "esnext",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"noEmit": true
|
|
||||||
},
|
|
||||||
"include": ["**/*.ts"],
|
|
||||||
"exclude": ["node_modules", "**/node_modules/*"]
|
|
||||||
}
|
|
Loading…
Reference in a new issue