Update database #76
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: 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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- 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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 | |
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@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 | |
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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: gautamkrishnar/keepalive-workflow@3eb47f21355191080dca0f7662d45c192d2ef64d # v2.0.7 |