Skip to content

cache-upload

cache-upload #173

Workflow file for this run

name: cache-upload
# Uploads codex 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:
CODEX_API_TOKEN: ${{ secrets.CODEX_API_TOKEN }}
CODEX_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODEX_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 codex from scratch because released codex has a bug that prevents
# CODEX_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 codex
run: |
go build -o dist/codex ./cmd/codex
sudo mv ./dist/codex /usr/local/bin/
# - name: Install codex
# uses: khulnasoft/codex-install-action@v0.11.0
# 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 codex cache configure. This is currently not working
# as expected on CICD.
- name: Upload cache
run: |
codex cache upload
codex update
codex cache upload