mirror of
https://github.com/ryanccn/attic-action.git
synced 2024-11-19 22:16:35 +00:00
feat: initial commit
This commit is contained in:
commit
ac59a1f6d5
14 changed files with 509 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
node_modules/
|
1
.node-version
Normal file
1
.node-version
Normal file
|
@ -0,0 +1 @@
|
||||||
|
16
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
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.
|
23
action.yml
Normal file
23
action.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
name: "attic"
|
||||||
|
description: "Cache Nix derivations with attic"
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
endpoint:
|
||||||
|
description: "attic endpoint"
|
||||||
|
required: true
|
||||||
|
cache:
|
||||||
|
description: "attic cache"
|
||||||
|
required: true
|
||||||
|
paths:
|
||||||
|
description: "paths to upload"
|
||||||
|
required: true
|
||||||
|
token:
|
||||||
|
description: "attic token"
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "node16"
|
||||||
|
main: "dist/index.js"
|
||||||
|
post: "dist/post.js"
|
28
dist/index.js
vendored
Normal file
28
dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
dist/post.js
vendored
Normal file
8
dist/post.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
package.json
Normal file
22
package.json
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "@ryanccn/attic-action",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "Cache Nix derivations with attic",
|
||||||
|
"scripts": {
|
||||||
|
"build": "esbuild src/index.ts src/post.ts --outdir=dist --platform=node --format=cjs --bundle --minify-whitespace --minify-syntax"
|
||||||
|
},
|
||||||
|
"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",
|
||||||
|
"typescript": "^5.1.6"
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@8.6.9"
|
||||||
|
}
|
320
pnpm-lock.yaml
Normal file
320
pnpm-lock.yaml
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
/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
|
10
src/index.ts
Normal file
10
src/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { install } from "./stages/install";
|
||||||
|
import { configure } from "./stages/configure";
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await install();
|
||||||
|
await configure();
|
||||||
|
})().catch((e) => {
|
||||||
|
console.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
8
src/post.ts
Normal file
8
src/post.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { push } from "./stages/push";
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await push();
|
||||||
|
})().catch((e) => {
|
||||||
|
console.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
11
src/stages/configure.ts
Normal file
11
src/stages/configure.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { getInput, startGroup, endGroup } from "@actions/core";
|
||||||
|
import { exec } from "@actions/exec";
|
||||||
|
|
||||||
|
export const configure = async () => {
|
||||||
|
startGroup("Configure attic");
|
||||||
|
const endpoint = getInput("endpoint");
|
||||||
|
const token = getInput("token");
|
||||||
|
|
||||||
|
await exec("attic", ["login", "--set-default", "ci", endpoint, token]);
|
||||||
|
endGroup();
|
||||||
|
};
|
29
src/stages/install.ts
Normal file
29
src/stages/install.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import { startGroup, endGroup } 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 () => {
|
||||||
|
startGroup("Install attic");
|
||||||
|
|
||||||
|
const installScript = await fetch(
|
||||||
|
"https://raw.githubusercontent.com/zhaofengli/attic/main/.github/install-attic-ci.sh"
|
||||||
|
).then((r) => {
|
||||||
|
if (!r.ok)
|
||||||
|
throw new Error(
|
||||||
|
`Failed to fetch install script: ${r.status} ${r.statusText}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return r.text();
|
||||||
|
});
|
||||||
|
|
||||||
|
const installScriptPath = join(tmpdir(), "install-attic-ci.sh");
|
||||||
|
|
||||||
|
await writeFile(installScriptPath, installScript);
|
||||||
|
await exec("bash", [installScriptPath]);
|
||||||
|
|
||||||
|
endGroup();
|
||||||
|
};
|
9
src/stages/push.ts
Normal file
9
src/stages/push.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { getInput, getMultilineInput } from "@actions/core";
|
||||||
|
import { exec } from "@actions/exec";
|
||||||
|
|
||||||
|
export const push = async () => {
|
||||||
|
const cache = getInput("cache");
|
||||||
|
const paths = getMultilineInput("token");
|
||||||
|
|
||||||
|
await exec("attic", ["push", cache, ...paths]);
|
||||||
|
};
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"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