on master help sign in
Fixed image build and use pre-post for cache
43a0d97iko
.github/actions/nix_cache/action.yaml+11−9
@@ -14,12 +14,14 @@ runs:
14 path: |
14 path: |
15 ~/nix/store
15 ~/nix/store
16 key: ${{ inputs.key }}
16 key: ${{ inputs.key }}
17− - name: Move nix cache
17+ - name: Move nix store
18− shell: bash
18+ uses: ilyakooo0/github-composite-action-pre-post@1.0.0
19− env:
19+ with:
20− CACHE_HIT: ${{ steps.cache-nix.outputs.cache-hit }}
20+ pre: |
21− run: |
21+ if [[ -d ~/nix/store ]]; then
22− if [[ "$CACHE_HIT" == 'true' ]]; then
23− sudo mkdir -p $NIX_STORE
22+ sudo mkdir -p /nix/store
24− sudo mv -f ~/nix/store/* /nix/store/
23+ sudo mv -f ~/nix/store/* /nix/store/
25− fi
24+ fi
25+ post: |
26+ mkdir -p ~/nix/store
27+ sudo mv -f /nix/store/* ~/nix/store/
.github/actions/nix_cache_post/action.yamldeleted−10
@@ -1,10 +0,0 @@
1−name: "Nix cache post"
2−description: "Cache nix build post"
3−runs:
4− using: "composite"
5− steps:
6− - name: Move nix cache
7− shell: bash
8− run: |
9− mkdir -p ~/nix/store
10− sudo mv -f /nix/store/* ~/nix/store/
.github/workflows/github-actions-image.yaml+1−10
@@ -52,7 +52,7 @@ jobs:
52 shell: bash
52 shell: bash
53 run: |
53 run: |
54 cp $(nix-build -A compaRESTGithubAction -j auto) compaREST-Github-Action-image.tar.gz
54 cp $(nix-build -A compaRESTGithubAction -j auto) compaREST-Github-Action-image.tar.gz
55− cp $(nix-build -A compaRESTImage-j auto) compaREST-image.tar.gz
55+ cp $(nix-build -A compaRESTImage -j auto) compaREST-image.tar.gz
56
56
57 - name: Upload compaREST Github Action Image
57 - name: Upload compaREST Github Action Image
58 uses: actions/upload-artifact@v2
58 uses: actions/upload-artifact@v2
@@ -114,9 +114,6 @@ jobs:
114 asset_name: compaREST binary – Linux – x86
114 asset_name: compaREST binary – Linux – x86
115 tag: ${{ github.ref }}
115 tag: ${{ github.ref }}
116
116
117− - name: Cache Nix post
118− uses: ./.github/actions/nix_cache_post
119−
120 macOS:
117 macOS:
121 runs-on: macos-latest
118 runs-on: macos-latest
122 steps:
119 steps:
@@ -152,9 +149,6 @@ jobs:
152 asset_name: compaREST binary – macOS – x86
149 asset_name: compaREST binary – macOS – x86
153 tag: ${{ github.ref }}
150 tag: ${{ github.ref }}
154
151
155− - name: Cache Nix post
156− uses: ./.github/actions/nix_cache_post
157−
158 Linux-Windows:
152 Linux-Windows:
159 runs-on: ubuntu-latest
153 runs-on: ubuntu-latest
160 steps:
154 steps:
@@ -201,6 +195,3 @@ jobs:
201 file: compaREST
195 file: compaREST
202 asset_name: compaREST binary – Windows
196 asset_name: compaREST binary – Windows
203 tag: ${{ github.ref }}
197 tag: ${{ github.ref }}
204−
205− - name: Cache Nix post
206− uses: ./.github/actions/nix_cache_post