-
Notifications
You must be signed in to change notification settings - Fork 203
60 lines (52 loc) · 1.54 KB
/
cache-upload.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: cache-upload
# Uploads devbox nix dependencies to cache
on:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: '30 8 * * *' # Run nightly at 8:30 UTC
permissions:
contents: read
pull-requests: read
defaults:
run:
shell: bash
env:
DEVBOX_API_TOKEN: ${{ secrets.DEVBOX_API_TOKEN }}
DEVBOX_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEVBOX_DEBUG: 1
jobs:
upload-cache:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
# Build devbox from scratch because released devbox has a bug that prevents
# DEVBOX_API_TOKEN use
# we can remove this after 0.10.6 is out.
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- name: Build devbox
run: |
go build -o dist/devbox ./cmd/devbox
sudo mv ./dist/devbox /usr/local/bin/
# - name: Install devbox
# uses: jetify-com/[email protected]
# with:
# enable-cache: true
# We upload twice, once before updating and once after. This shows a simple
# method to cache the latest current and latest dependencies.
# If we want read access to cache on multi-user nix installs (e.g. macos),
# we need to call devbox cache configure. This is currently not working
# as expected on CICD.
- name: Upload cache
run: |
devbox cache upload
devbox update
devbox cache upload