Generate package database #17680
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Generate package database" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 * * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: DeterminateSystems/nix-installer-action@v4 | |
- uses: DeterminateSystems/magic-nix-cache-action@v2 | |
- name: SnowflakeOS Cache | |
uses: cachix/cachix-action@v12 | |
with: | |
name: snowflakeos | |
- name: Create databases | |
run: | | |
sleep $((RANDOM % 60)) | |
for Line in $(cat versions) | |
do | |
PREV_VERSION=$(cat $Line/nixpkgs.ver) | |
RUST_LOG=nix_data_generator=trace nix develop --command -- nix-data-generator -v $Line --src $Line 1>&2 | |
NEW_VERSION=$(cat $Line/nixpkgs.ver) | |
if [ "$PREV_VERSION" != "$NEW_VERSION" ]; then | |
if [ -f "$Line/nixpkgs.db" ]; then | |
brotli ./$Line/nixpkgs.db -o ./$Line/nixpkgs.db.br -v -f 1>&2 | |
fi | |
if [ -f "$Line/nixpkgs_versions.db" ]; then | |
brotli ./$Line/nixpkgs_versions.db -o ./$Line/nixpkgs_versions.db.br -v -f 1>&2 | |
fi | |
fi | |
done | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update databases | |
commit_user_email: dev@snowflakeos.org | |
commit_author: GitHub Actions <dev@snowflakeos.org> |