Skip to content

Commit

Permalink
simplify workflows, update badges
Browse files Browse the repository at this point in the history
  • Loading branch information
ipitio committed Dec 2, 2024
1 parent 3bf89d2 commit d2c1a10
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,7 @@ jobs:
- name: Get date
id: date
run: |
echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/7))" >> "$GITHUB_OUTPUT"
- name: Save state
id: commit
if: ${{ steps.update.outputs.updated == '0' }}
uses: EndBug/add-and-commit@v9
with:
add: "-- *.txt README.md"
message: "${{ steps.date.outputs.date }}"
run: echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/7))" >> "$GITHUB_OUTPUT"

- name: Save database
if: ${{ steps.update.outputs.updated == '0' }}
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: update

on:
schedule:
- cron: "* */3 * * *"
- cron: "* */5 * * *"

concurrency:
group: ${{ github.ref }}
Expand Down Expand Up @@ -56,17 +56,7 @@ jobs:
- name: Get date
id: date
run: |
echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/7))" >> "$GITHUB_OUTPUT"
- name: Save state
id: commit
if: ${{ steps.update.outputs.updated == '0' }}
uses: EndBug/add-and-commit@v9
with:
add: "-- *.txt README.md"
message: "${{ steps.date.outputs.date }}"
run: echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/7))" >> "$GITHUB_OUTPUT"

- name: Save database
if: ${{ steps.update.outputs.updated == '0' }}
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

---

[![build](https://github.com/ipitio/backage/actions/workflows/publish.yml/badge.svg)](https://github.com/ipitio/backage/pkgs/container/backage) [![packages](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fipitio%2Fbackage%2Fraw%2Findex%2F.json&query=%24.packages&logo=github&logoColor=959da5&label=packages&labelColor=333a41&color=2ebc4f)](https://github.com/ipitio/backage/tree/index) [![date](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fipitio%2Fbackage%2Fraw%2Findex%2F.json&query=%24.date&logo=github&logoColor=959da5&label=refreshed&labelColor=333a41&color=2ebc4f)](https://github.com/ipitio/backage/releases/latest)
[![build](https://github.com/ipitio/backage/actions/workflows/publish.yml/badge.svg)](https://github.com/ipitio/backage/pkgs/container/backage) [![packages](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fipitio%2Fbackage%2Fraw%2Findex%2F.json&query=%24.packages&logo=github&logoColor=959da5&label=packages&labelColor=333a41&color=deepskyblue)](https://github.com/ipitio/backage/tree/index) [![refreshes](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fipitio.github.io%2Fbackage%2Fipitio%2Fbackage%2Fbackage.json&query=%24.downloads&logo=github&logoColor=959da5&label=refreshes&labelColor=333a41&color=peru)](https://github.com/ipitio/backage/releases/latest) [![latest](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fipitio%2Fbackage%2Fraw%2Findex%2F.json&query=%24.date&logo=github&logoColor=959da5&label=latest&labelColor=333a41&color=mediumorchid)](https://github.com/ipitio/backage/releases/latest)

</div>

The GitHub Packages API doesn't expose much of the publicly-available metadata that other registries provide. This completely automated closed-loop system [is the solution](https://github.com/badges/shields/issues/5594#issuecomment-2157626147). **Just star this project to have GitHub supplement its API with an additional endpoint for your public packages!**
The GitHub Packages API doesn't expose much of the publicly-available metadata that other registries provide, like downloads. This completely automated closed-loop system [is the solution](https://github.com/badges/shields/issues/5594#issuecomment-2157626147). **Just star this project to have GitHub supplement its API with an additional endpoint for your public packages!**

A service ran by GitHub will add them to its circular priority queue within the next few hours and update the [dataset](https://github.com/ipitio/backage/releases/latest). If you'd then like the service to forget and ignore some or all of your packages, add `owner[/repo[/package]]` to `optout.txt` [here](https://github.com/ipitio/backage/edit/master/optout.txt) and make a pull request.

Expand All @@ -28,7 +28,7 @@ To add any other users or organizations not yet [in the index](https://github.co
https://ipitio.github.io/backage/OWNER/REPO/PACKAGE.FORMAT
```

Use something like [shields.io/json](https://shields.io/badges/dynamic-json-badge) or [shields.io/xml](https://shields.io/badges/dynamic-xml-badge) with this endpoint to access the latest data and make badges like the ones above. Replace `OWNER/REPO/PACKAGE.FORMAT` with their respective values.
Replace `OWNER/REPO/PACKAGE.FORMAT` with their respective values, then use something like [shields.io/json](https://shields.io/badges/dynamic-json-badge) or [shields.io/xml](https://shields.io/badges/dynamic-xml-badge) to access the latest data and make badges like the `refreshes` one above.

> [!NOTE]
> The format can be either `json` or `xml`. You'll need the XML endpoint to evaluate expressions, like filters, with Shields -- see [this issue](https://github.com/ipitio/backage/issues/23).
Expand Down Expand Up @@ -129,21 +129,21 @@ $.version[?(@.latest)].tags[?(@!="latest")]
You can query a package for its properties, like size or version:
```py
/bkg/PROPERTY
/xml/PROPERTY
```
```py
/bkg/size
/xml/size
```
Versions can be filtered in and tags out:
```py
/bkg/version[FILTER]/PROPERTY
/xml/version[FILTER]/PROPERTY
```
```py
/bkg/version[./latest[.="true"]]/tags[.!="latest"]
/xml/version[./latest[.="true"]]/tags[.!="latest"]
```
</details>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ explore() {
}

ytox() {
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><bkg>$(yq -ox -I0 "$1" | sed 's/"/\\"/g')</bkg>" >"${1%.*}.xml"
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><xml>$(yq -ox -I0 "$1" | sed 's/"/\\"/g')</xml>" >"${1%.*}.xml"
}

ytoy() {
Expand Down
9 changes: 6 additions & 3 deletions src/test/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ if git worktree list | grep -q index; then
popd || exit 1
fi

git pull --rebase --autostash 2>/dev/null
git merge --abort 2>/dev/null
git pull --rebase --autostash -s ours &>/dev/null
(git pull --rebase --autostash 2>/dev/null)
(git merge --abort 2>/dev/null)
(git pull --rebase --autostash -s ours &>/dev/null)
git add -- *.txt README.md
git commit -m "$(date -u +%Y-%m-%d)"
git push

0 comments on commit d2c1a10

Please sign in to comment.