Skip to content

Commit a7fd6b9

Browse files
committed
test dev
1 parent c4278b7 commit a7fd6b9

File tree

5 files changed

+349
-67
lines changed

5 files changed

+349
-67
lines changed

.github/workflows/manual-dev.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: manual-dev
2+
3+
on:
4+
workflow_dispatch:
5+
6+
workflow_run:
7+
workflows: ["build-dev"]
8+
types: [completed]
9+
10+
pull_request:
11+
types:
12+
- closed
13+
14+
concurrency:
15+
group: ${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
defaults:
19+
run:
20+
# GitHub Actions run without a TTY device. This is a workaround to get one,
21+
# based on https://github.com/actions/runner/issues/241#issuecomment-2019042651
22+
shell: 'script --return --quiet --log-out /dev/null --command "bash -e {0}"'
23+
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
GITHUB_OWNER: ${{ github.repository_owner }}
27+
GITHUB_REPO: ${{ github.event.repository.name }}
28+
GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }}
29+
30+
jobs:
31+
update:
32+
runs-on: ubuntu-latest
33+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
34+
35+
permissions:
36+
contents: write
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
- name: Tune dpkg
43+
uses: abbbi/github-actions-tune@v1
44+
45+
- name: Set dpkg
46+
run: sudo rm -f /usr/local/bin/dpkg
47+
48+
- name: Tune apt
49+
uses: firebuild/apt-eatmydata-action@v1
50+
51+
- name: Check for release
52+
id: release
53+
continue-on-error: true
54+
uses: cardinalby/git-get-release-action@v1
55+
with:
56+
latest: true
57+
58+
- name: Fetch all data
59+
if: ${{ steps.release.outcome == 'success' }}
60+
continue-on-error: true
61+
uses: robinraju/release-downloader@v1
62+
with:
63+
latest: true
64+
fileName: "*.zst"
65+
tarBall: false
66+
zipBall: false
67+
68+
- name: Dry run
69+
id: update
70+
run: |
71+
docker run -v $PWD:/app --env-file <(env | grep GITHUB) \
72+
ghcr.io/$GITHUB_OWNER/$GITHUB_REPO:master \
73+
src/test/update.sh; echo "updated=$?" >> "$GITHUB_OUTPUT"
74+
75+
- name: Get date
76+
id: date
77+
run: echo "tag=$(date -u +%-Y.%-m).$((($(date -u +%-d)-1)/14))" >> "$GITHUB_OUTPUT"
78+
79+
- name: Save database
80+
if: ${{ steps.update.outputs.updated == '0' }}
81+
uses: ncipollo/release-action@v1
82+
with:
83+
artifacts: "*.zst"
84+
bodyFile: "CHANGELOG.md"
85+
tag: "v${{ steps.date.outputs.tag }}"
86+
commit: "master"
87+
allowUpdates: true

.github/workflows/publish-dev.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: build-dev
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches:
8+
- dev
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build-and-push-image:
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Log in to the Container registry
27+
uses: docker/[email protected]
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/[email protected]
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
39+
- name: Build and push Docker image
40+
uses: docker/[email protected]
41+
with:
42+
context: .
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

src/lib/owner.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ update_owner() {
124124
find "$BKG_INDEX_DIR/$owner" -type f -name '*.json' ! -name '.*' -print0 | xargs -0 jq -cs '[.] | add' >"$BKG_INDEX_DIR/$owner/.json.tmp"
125125
jq -cs '{ ("package"): . }' "$BKG_INDEX_DIR/$owner/.json.tmp" >"$BKG_INDEX_DIR/$owner/.json"
126126
ytoxt "$BKG_INDEX_DIR/$owner/.json"
127-
mv -f "$BKG_INDEX_DIR/$owner/.json.tmp" "$BKG_INDEX_DIR/$owner/.json"
127+
jq -c '.package[]' "$BKG_INDEX_DIR/$owner/.json" >"$BKG_INDEX_DIR/$owner/.json.tmp" 2>/dev/null
128+
mv -f "$BKG_INDEX_DIR/$owner/.json.tmp" "$BKG_INDEX_DIR/$owner/.json" 2>/dev/null
128129

129130
echo "Creating $owner repo arrays..."
130131
parallel "jq -c --arg repo {} '[.[] | select(.repo == \$repo)]' \"$BKG_INDEX_DIR/$owner/.json\" > \"$BKG_INDEX_DIR/$owner/{}/.json.tmp\"" <<<"$owner_repos"
131132
xargs -I {} bash -c "jq -cs '{ (\"package\"): . }' \"$BKG_INDEX_DIR/$owner/{}/.json.tmp\" > \"$BKG_INDEX_DIR/$owner/{}/.json\"" <<<"$owner_repos"
132133
xargs -I {} bash -c "ytoxt \"$BKG_INDEX_DIR/$owner/{}/.json\"" <<<"$owner_repos"
133-
xargs -I {} mv -f "$BKG_INDEX_DIR/$owner/{}/.json.tmp" "$BKG_INDEX_DIR/$owner/{}/.json" <<<"$owner_repos"
134+
xargs -I {} bash -c "jq -c '.package[]' \"$BKG_INDEX_DIR/$owner/{}/.json\" > \"$BKG_INDEX_DIR/$owner/{}/.json.tmp\"" 2>/dev/null <<<"$owner_repos"
135+
xargs -I {} mv -f "$BKG_INDEX_DIR/$owner/{}/.json.tmp" "$BKG_INDEX_DIR/$owner/{}/.json" 2>/dev/null <<<"$owner_repos"
134136
fi
135137

136138
sed -i '/^\(.*\/\)*'"$owner"'$/d' "$BKG_OWNERS"

0 commit comments

Comments
 (0)