-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (116 loc) · 4.65 KB
/
bootstrap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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