mirror of
https://github.com/captn3m0/microsoft-kb-metadata.git
synced 2024-09-19 15:57:01 +00:00
Publish SQLite and CSV dataset with GitHub Actions
This commit is contained in:
parent
5f8263844c
commit
6839f54d75
32
.github/workflows/publish.yml
vendored
Normal file
32
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
name: Publish Dataset
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # Runs at midnight UTC every day
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
needs: update
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install csv-to-sqlite
|
||||
run: pip install csv-to-sqlite
|
||||
- name: Convert JSON to CSV
|
||||
run: jq -r '"kb,date,url,slug,uuid", keys[] as $k | [$k] + [ .[$k].date, .[$k].url, .[$k].slug, .[$k].uuid ]|@csv' data.json > data.csv
|
||||
- name: Convert CSV to SQLite
|
||||
run: csv-to-sqlite -f data.csv -o data.sqlite --tables data --columns "date,uuid,url,slug,kb"
|
||||
- name: Create and push tag
|
||||
run: |
|
||||
TAG_NAME=v$(date +'%Y.%m.%d')
|
||||
git tag $TAG_NAME
|
||||
git push origin $TAG_NAME
|
||||
- name: Publish files to GitHub Releases
|
||||
run: |
|
||||
gh release create $TAG_NAME data.json data.csv data.sqlite --title "Release $TAG_NAME"
|
Loading…
Reference in New Issue
Block a user