mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-08 23:18:10 -05:00
Add script and action for generating JSON for Repology (#7376)
This commit is contained in:
committed by
GitHub
parent
824b9f65a6
commit
670379c9cf
23
.github/workflows/Repology.yml
vendored
Normal file
23
.github/workflows/Repology.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Generate Repology JSON
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # Every Sunday at midnight
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Generate JSON
|
||||
run: |
|
||||
sudo docker pull satmandu/crewbuild:amd64
|
||||
sudo docker run -t -v $(pwd):/usr/local/json satmandu/crewbuild:amd64 /bin/bash -c "
|
||||
git clone https://github.com/chromebrew/chromebrew
|
||||
cd chromebrew/tools
|
||||
ruby json.rb
|
||||
cp repology.json /usr/local/json"
|
||||
- name: Upload JSON arifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: repology-json
|
||||
path: repology.json
|
||||
16
tools/json.rb
Normal file
16
tools/json.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
require 'json'
|
||||
|
||||
# Add >LOCAL< lib to LOAD_PATH
|
||||
$LOAD_PATH.unshift '../lib'
|
||||
|
||||
require_relative '../lib/const'
|
||||
require_relative '../lib/package'
|
||||
|
||||
output = Array.new
|
||||
|
||||
Dir.glob('../packages/*.rb').each do |filename|
|
||||
pkg = Package.load_package(filename)
|
||||
output << {name: File.basename(filename, '.rb'), description: pkg.description, homepage: pkg.homepage, version: pkg.version, license: pkg.license, compatibility: pkg.compatibility}
|
||||
end
|
||||
|
||||
File.write('repology.json', JSON.generate(output))
|
||||
Reference in New Issue
Block a user