mirror of
https://github.com/tauri-apps/gir-files.git
synced 2026-01-31 00:45:15 +01:00
Create weekly scheduled workflow to update GIR files (#81)
This commit is contained in:
committed by
GitHub
parent
b4887eac49
commit
8fad972496
36
.github/workflows/regenerate_scheduled.yml
vendored
Normal file
36
.github/workflows/regenerate_scheduled.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Redownload & regenerate (weekly)
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
jobs:
|
||||
regenerate:
|
||||
name: Regenerate GIR files
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Redownload, regenerate, reformat
|
||||
id: changes
|
||||
run: |
|
||||
sudo apt-get update > /dev/null
|
||||
sudo apt-get -qq upgrade > /dev/null
|
||||
sudo apt-get -qq install binutils wget tar xmlstarlet flatpak > /dev/null
|
||||
flatpak remote-add --user --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
|
||||
flatpak install org.gnome.Sdk//master -y --noninteractive
|
||||
flatpak run --command=python3 --filesystem=home org.gnome.Sdk//master dl.py
|
||||
./reformat.sh && ./fix.sh
|
||||
echo ::set-output name=pr_title::"Update GIR files ($(date +%Y-%m-%d))"
|
||||
echo ::set-output name=pr_body::"This PR was auto-generated on $(date +%Y-%m-%d). Please review and manually edit before merging."
|
||||
- name: Create PR
|
||||
id: cpr
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
commit-message: Update GIR files
|
||||
title: ${{ steps.changes.outputs.pr_title }}
|
||||
body: ${{ steps.changes.outputs.pr_body }}
|
||||
delete-branch: true
|
||||
- name: Review PR
|
||||
run: |
|
||||
echo "Opened PR #${{ steps.cpr.outputs.pull-request-number }} (${{ steps.cpr.outputs.pull-request-url }}) — ${{ steps.changes.outputs.pr_title }}"
|
||||
@@ -8,7 +8,10 @@ files used to generate all [`gtk-rs`](https://github.com/gtk-rs/gtk-rs) crates.
|
||||
You can update all the files by doing:
|
||||
|
||||
```console
|
||||
$ ./dl.sh
|
||||
$ flatpak remote-add --user --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
|
||||
$ flatpak install org.gnome.Sdk//master -y --noninteractive
|
||||
$ flatpak run --command=python3 --filesystem=home org.gnome.Sdk//master dl.py
|
||||
$ ./reformat.sh && ./fix.sh
|
||||
```
|
||||
|
||||
This command will fetch the gir files for the latest release of each library.
|
||||
|
||||
27
dl.py
Executable file
27
dl.py
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import shutil
|
||||
|
||||
GIR_FILES=[
|
||||
"Atk-1.0", "cairo-1.0", "fontconfig-2.0", "freetype2-2.0", "Gdk-3.0", "Gdk-4.0",
|
||||
"GdkPixbuf-2.0", "GdkPixdata-2.0", "GdkWayland-4.0", "GdkX11-3.0",
|
||||
"GdkX11-4.0", "Gio-2.0", "GL-1.0", "GLib-2.0",
|
||||
"GModule-2.0", "GObject-2.0", "Graphene-1.0",
|
||||
"Gsk-4.0", "Gtk-3.0", "Gtk-4.0", "HarfBuzz-0.0",
|
||||
"libxml2-2.0", "Pango-1.0",
|
||||
"PangoCairo-1.0", "PangoFc-1.0",
|
||||
"PangoFT2-1.0", "PangoOT-1.0",
|
||||
"PangoXft-1.0", "Vulkan-1.0",
|
||||
"win32-1.0", "xfixes-4.0",
|
||||
"xft-2.0", "xlib-2.0", "xrandr-1.3",
|
||||
]
|
||||
|
||||
dest_dir = os.path.abspath("./")
|
||||
|
||||
for file in GIR_FILES:
|
||||
src = f"/usr/share/gir-1.0/{file}.gir"
|
||||
dest = f"{dest_dir}/{file}.gir"
|
||||
try:
|
||||
shutil.copy(src, dest)
|
||||
except FileNotFoundError:
|
||||
print(f"gir file not found {file}")
|
||||
14
dl.sh
14
dl.sh
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libatk1.0-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libgirepository1.0-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libgraphene-1.0-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libgdk-pixbuf-2.0-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libgtk-3-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libgtk-4-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libharfbuzz-dev/download http.us.debian.org
|
||||
./gir-dl.sh https://packages.debian.org/unstable/amd64/libpango1.0-dev/download http.us.debian.org
|
||||
|
||||
./reformat.sh
|
||||
./fix.sh
|
||||
21
gir-dl.sh
21
gir-dl.sh
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e -u -o pipefail
|
||||
|
||||
MIRRORS="$1"
|
||||
echo $MIRRORS
|
||||
WGETPARAMS="--tries=10 --retry-on-http-error=500 --waitretry=1 --show-progress"
|
||||
EXTRA_MIRROR=security.ubuntu.com/ubuntu/pool
|
||||
if [ $# -lt 2 ]; then
|
||||
MIRROR="mirrors.kernel.org"
|
||||
else
|
||||
MIRROR="$2"
|
||||
fi
|
||||
wget $WGETPARAMS -O tmp.html "$MIRRORS"
|
||||
URL=`cat tmp.html | grep -oP "http://($MIRROR|$EXTRA_MIRROR)/[^\"]+"`
|
||||
rm tmp.html
|
||||
echo $URL
|
||||
wget $WGETPARAMS -O tmp.deb "$URL"
|
||||
ar x tmp.deb data.tar.xz
|
||||
rm tmp.deb
|
||||
tar xf data.tar.xz --strip-components 4 ./usr/share/gir-1.0
|
||||
rm data.tar.xz
|
||||
Reference in New Issue
Block a user