Skip to content

Commit 2071ebd

Browse files
committed
feat: add inputs-from option (closes #28)
1 parent 7d151bb commit 2071ebd

File tree

11 files changed

+180
-172
lines changed

11 files changed

+180
-172
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Test"
1+
name: "Build"
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
test-cache:
10+
build:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, macos-latest]
@@ -21,21 +21,12 @@ jobs:
2121
- uses: pnpm/action-setup@v3
2222
- uses: actions/setup-node@v4
2323
with:
24+
node-version-file: .node-version
2425
cache: pnpm
2526
cache-dependency-path: pnpm-lock.yaml
2627

27-
- name: Build
28-
run: pnpm install && pnpm build
29-
30-
- name: Install Nix
31-
uses: DeterminateSystems/nix-installer-action@v9
28+
- name: Install dependencies
29+
run: pnpm install
3230

33-
- name: Setup Attic Cache
34-
uses: ./
35-
with:
36-
endpoint: ${{ secrets.ATTIC_ENDPOINT }}
37-
cache: ${{ secrets.ATTIC_CACHE }}
38-
token: ${{ secrets.ATTIC_TOKEN }}
39-
40-
- name: Build Nix Package
41-
run: nix-build test.nix
31+
- name: Build
32+
run: pnpm run build

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ jobs:
2020
- uses: pnpm/action-setup@v3
2121
- uses: actions/setup-node@v4
2222
with:
23+
node-version-file: .node-version
2324
cache: pnpm
2425
cache-dependency-path: pnpm-lock.yaml
2526

27+
- name: Install dependencies
28+
run: pnpm install
29+
2630
- name: Build
27-
run: pnpm install && pnpm build
31+
run: pnpm run build
2832

2933
- uses: JasonEtco/build-and-tag-action@v2
3034
env:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Cache Nix derivations with [Attic](https://github.com/zhaofengli/attic).
44

55
## Usage
66

7-
Configure your attic instance with an endpoint, a cache, and a token that can read from and write to the cache. Then, add this step to a workflow job after Nix is installed:
7+
Configure your Attic instance with an endpoint, a cache, and a token that can read from and write to the cache. Then, add this step to a workflow job after Nix is installed:
88

99
```yaml
1010
- name: Setup Attic cache

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "attic-action"
22
author: "Ryan Cao"
3-
description: "Cache Nix derivations with attic"
3+
description: "Cache Nix derivations with Attic"
44

55
branding:
66
icon: "layers"
@@ -13,14 +13,17 @@ inputs:
1313
cache:
1414
description: "Attic cache name"
1515
required: true
16+
inputs-from:
17+
description: "Path to get the Nixpkgs flake input from instead of `github:NixOS/nixpkgs/nixpkgs-unstable`"
18+
required: false
1619
skip-push:
1720
description: "Disable pushing to the cache automatically"
1821
required: false
1922
token:
2023
description: "Attic authorization token"
2124
required: false
2225
skip-use:
23-
description: "Set to true to skip using attic cache as a substituter"
26+
description: "Set to true to skip using Attic cache as a substituter"
2427
required: false
2528

2629
runs:

flake.lock

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
description = "Github Action for caching Nix derivations with attic";
2+
description = "Github Action for caching Nix derivations with Attic";
33

44
inputs = {
55
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ryanccn/attic-action",
33
"main": "dist/index.js",
4-
"description": "Cache Nix derivations with attic",
4+
"description": "Cache Nix derivations with Attic",
55
"scripts": {
66
"build": "esbuild src/index.ts --outdir=dist --platform=node --format=cjs --bundle --minify-whitespace --minify-syntax",
77
"format": "prettier --write ."
@@ -14,10 +14,15 @@
1414
"@actions/io": "^1.1.3"
1515
},
1616
"devDependencies": {
17-
"@types/node": "^20.16.10",
18-
"esbuild": "^0.24.0",
19-
"prettier": "3.3.3",
20-
"typescript": "^5.6.3"
17+
"@types/node": "^22.13.11",
18+
"esbuild": "^0.25.1",
19+
"prettier": "3.5.3",
20+
"typescript": "^5.8.2"
2121
},
22-
"packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4"
22+
"pnpm": {
23+
"onlyBuiltDependencies": [
24+
"esbuild"
25+
]
26+
},
27+
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
2328
}

0 commit comments

Comments
 (0)