Integration · GitHub Actions
Your repository,
backed up every night.
A workflow bundles every branch and tag, encrypts it inside the runner with your vault key, and stores it in OzVault, keeping the newest 14. Publishing a release stores its assets too.
on:
schedule:
- cron: "17 3 * * *" # every night
release:
types: [published] # stores release assets
steps:
- name: Back up the repository
run: |
git bundle create repo.bundle --all
node ozvault.mjs backup repo.bundle \
--name "${{ github.event.repository.name }}.bundle" \
--keep 14Set up
Three secrets, one file.
- 01
Add the workflow
Run this in your repository, or download the ZIP (2 KB) and copy.github/workflows/ozvault-backup.yml.ozvault init github-actions - 02
Add three repository secrets
Settings → Secrets and variables → Actions:OZVAULT_API_KEY(objects:read and objects:write, limited to one bucket),OZVAULT_VAULT_KEYandOZVAULT_BUCKET_ID. - 03
Run it once
Start it from the Actions tab (workflow_dispatch). After that it runs nightly at 03:17 UTC and on every published release.
The workflow
Short, readable and pinned.
It downloads one exact version of the OzVault CLI and refuses to run it unless the SHA-256 matches. Nothing else is installed.
# Nightly encrypted backup of this repository to OzVault, keeping the newest 14.
# Also stores release assets when you publish a release.
#
# Repository → Settings → Secrets and variables → Actions:
# OZVAULT_API_KEY API key with objects:read and objects:write (limit it to one bucket)
# OZVAULT_VAULT_KEY your vault key (ozvault keygen); files are encrypted with it in the runner
# OZVAULT_BUCKET_ID the bucket to store backups in
name: OzVault backup
on:
schedule:
- cron: "17 3 * * *"
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
backup:
runs-on: ubuntu-latest
env:
OZVAULT_API_KEY: ${{ secrets.OZVAULT_API_KEY }}
OZVAULT_VAULT_KEY: ${{ secrets.OZVAULT_VAULT_KEY }}
OZVAULT_BUCKET: ${{ secrets.OZVAULT_BUCKET_ID }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # full history, so the bundle can restore everything
- uses: actions/setup-node@v5
with:
node-version: 24
- name: Get the OzVault CLI (pinned and verified)
run: |
curl -fsSL "https://ozvault.lol/cli/ozvault-0.1.0.mjs" -o ozvault.mjs
echo "0f659a112aba912996215675e2a3a02fb95f2b60a75ada460b55bfce7789ba00 ozvault.mjs" | sha256sum --check
- name: Back up the repository
if: github.event_name != 'release'
run: |
git bundle create repo.bundle --all
node ozvault.mjs backup repo.bundle --name "${{ github.event.repository.name }}.bundle" --keep 14
- name: Store release assets
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p assets
gh release download "${{ github.event.release.tag_name }}" --dir assets || true
for file in assets/*; do
[ -f "$file" ] && node ozvault.mjs upload "$file" --to "releases/${{ github.event.release.tag_name }}/"
done
# Restore a repository backup:
# ozvault restore-backup --bucket <bucket> --name <repo>.bundle -o repo.bundle
# git clone repo.bundle restored-repoRestore
Two commands to get it all back.
ozvault restore-backup --bucket backups --name my-repo.bundle -o repo.bundle
git clone repo.bundle my-repo- Kept
- Newest 14 backups
- Contains
- All branches and tags
- Encrypted
- In the runner, AES-256-GCM
- CLI
- v0.1.0, pinned
GitHub Action
Prefer uses:? The Action is ready to publish.
The same features as a JavaScript Action: upload build artifacts by glob, rotating backups, and share links as a masked output. It isn't on the GitHub Marketplace yet.
- uses: ozvault/action@v1 # once published; see below
with:
api-key: ${{ secrets.OZVAULT_API_KEY }}
vault-key: ${{ secrets.OZVAULT_VAULT_KEY }}
bucket: backups
path: repo.bundle
backup-name: ${{ github.event.repository.name }}.bundle
keep: 14Until it’s published, use the workflow above. It does the same job through the CLI. The Action’s source ships with OzVault in
integrations/github-action; you can also copy it into your repository and use uses: ./.github/actions/ozvault.Back up a Discord bot too.
The discord.js template keeps rotating, encrypted backups of your bot's data.