Skip to content

Update database

Update database #70

Workflow file for this run

name: Update database
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
schedule:
- cron: "0 5 * * 1" # Mondays @ 5am
- cron: "0 1 1 * *" # First day of the month @ 1am
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: write
env:
DBNAME: path_to_artifacts
PYTHONUNBUFFERED: 1
jobs:
update:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Fetch latest release
run: |
set -x
curl -L -o ${DBNAME}.tar.zst \
https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/${DBNAME}.tar.zst
tar xf ${DBNAME}.tar.zst
rm ${DBNAME}.tar.zst
- uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
- name: Update database with most recent repodata
run: |
set -x
ls -alh *.db
pixi run python conda_forge_paths/path_to_artifacts_db.py update-from-repodata
ls -alh *.db
- name: Update FTS index
run: |
set -x
ls -alh *.db
pixi run python conda_forge_paths/path_to_artifacts_db.py fts
ls -alh *.db
- name: Get current time
uses: josStorer/get-current-time@060cae3fbd32c181c6841788189a601ac8df8389 # v2.1.2
id: current-time
with:
format: "YYYY-MM-DD"
utcOffset: "+00:00"
- name: Compress DB file (for quick tests)
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: |
ZSTD_NBTHREADS=$(nproc) ZSTD_CLEVEL=9 tar --zstd -cf ${DBNAME}.tar.zst ${DBNAME}.db
ls -alh ${DBNAME}.*
- name: Compress DB file (for release)
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: |
ZSTD_NBTHREADS=$(nproc) ZSTD_CLEVEL=19 tar --zstd -cf ${DBNAME}.tar.zst ${DBNAME}.db
ls -alh ${DBNAME}.*
- name: Generate SHA256 checksums
run: |
openssl sha256 ${DBNAME}.db > ${DBNAME}.db.sha256
openssl sha256 ${DBNAME}.tar.zst > ${DBNAME}.tar.zst.sha256
- name: Remove uncompressed database
run: |
rm ${DBNAME}.db
rm ${DBNAME}.db-journal || true
- name: "Upload Artifact"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
with:
name: database
path: ${{ env.DBNAME }}.*
retention-days: 60
compression-level: 0
- name: Publish weekly
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v2.0.6
if: github.event_name == 'schedule' && !endsWith(steps.current-time.outputs.formattedTime, '-01')
with:
draft: false
name: "Latest Release"
tag_name: "latest"
files: ${{ env.DBNAME }}.*
fail_on_unmatched_files: true
body: |
Weekly snapshot of the conda-forge path-to-artifacts database.
Last updated on ${{ steps.current-time.outputs.formattedTime }}.
See the README for more information.
- name: Publish monthly or manually
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v2.0.6
if: ( github.event_name == 'schedule' && endsWith(steps.current-time.outputs.formattedTime, '-01') ) || github.event_name == 'workflow_dispatch'
with:
draft: false
name: ${{ steps.current-time.outputs.formattedTime }}
tag_name: ${{ steps.current-time.outputs.formattedTime }}
files: ${{ env.DBNAME }}.*
fail_on_unmatched_files: true
body: |
${{ steps.current-time.outputs.formattedTime }} snapshot of the conda-forge path-to-artifacts database.
keepalive-job:
name: Keep workflow alive
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: gautamkrishnar/keepalive-workflow@05456e7809058d586d96392e99217726ccc10076 # v2.0.5