Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1227 commits
Select commit Hold shift + click to select a range
34f216c
Merge branch 'meeb:main' into test-2
tcely Apr 29, 2025
951e3b3
Merge pull request #629 from tcely/patch-2
tcely Apr 29, 2025
1774ec7
Merge branch 'test-2' into resolve-upstream-main
tcely May 3, 2025
5fed7cb
Reorder blocks
tcely May 3, 2025
1931125
Reorder stages in Dockerfile
tcely May 3, 2025
958a9b7
Use the populated apt caches
tcely May 3, 2025
932a260
Merge pull request #634 from tcely/resolve-upstream-main
tcely May 3, 2025
44a5176
Pin `magic-wormhole` to version `0.17.0`
tcely May 3, 2025
3059b75
Pin `magic-wormhole` to version `0.17.0`
tcely May 3, 2025
c7399b4
Try docker services
tcely May 3, 2025
76c9d7c
Merge branch 'meeb:main' into test-2
tcely May 10, 2025
0526044
Merge pull request #635 from tcely/patch-6
tcely May 10, 2025
bf22b1a
Merge pull request #636 from tcely/patch-6
tcely May 10, 2025
eac7c3f
Merge pull request #638 from tcely/patch-6
tcely May 10, 2025
ae7c43c
Merge branch 'meeb:main' into test-2
tcely May 13, 2025
aedaa6f
Copy generic functions from `sync.utils`
tcely May 16, 2025
0f58172
Merge branch 'meeb:main' into test-2
tcely May 17, 2025
4a297d2
Merge pull request #650 from tcely/patch-12
tcely May 17, 2025
d7ab05b
Merge pull request #651 from tcely/patch-12
tcely May 17, 2025
49e233d
Merge pull request #652 from tcely/patch-12
tcely May 17, 2025
2cd6790
Use the mailbox service image
tcely May 17, 2025
9753314
Merge branch 'meeb:main' into test-2
tcely May 17, 2025
5b484db
Merge pull request #654 from tcely/patch-4
tcely May 18, 2025
8f2c6d0
Merge pull request #655 from tcely/patch-3
tcely May 18, 2025
4aded04
Merge pull request #656 from tcely/patch-6
tcely May 18, 2025
4bb4a4f
Merge pull request #657 from tcely/patch-3
tcely May 18, 2025
fda43bd
Merge pull request #659 from tcely/patch-3
tcely May 18, 2025
790a84b
Merge pull request #658 from tcely/patch-4
tcely May 18, 2025
d27d77e
Merge pull request #660 from tcely/patch-4
tcely May 18, 2025
53bcfd4
Merge pull request #661 from tcely/patch-4
tcely May 18, 2025
bdadbaf
Merge branch 'meeb:main' into test-2
tcely May 19, 2025
dfc2e61
Merge pull request #662 from tcely/patch-6
tcely May 19, 2025
0c972d8
Merge pull request #663 from tcely/patch-3
tcely May 19, 2025
3779c8d
Merge pull request #664 from tcely/patch-3
tcely May 19, 2025
37ca261
Merge pull request #665 from tcely/patch-4
tcely May 19, 2025
003fb60
Merge pull request #666 from tcely/patch-3
tcely May 19, 2025
b09f49f
Merge pull request #667 from tcely/patch-10
tcely May 19, 2025
02189e5
Merge pull request #668 from tcely/patch-10
tcely May 19, 2025
a3a44e8
Merge pull request #669 from tcely/patch-12
tcely May 19, 2025
e46beb3
Merge branch 'main' into patch-2
tcely May 20, 2025
3aa5ec9
Remove `json_serial` as it is in json.py instead
tcely May 20, 2025
4805c26
Merge branch 'test-2' into resolve-upstream-main
tcely May 20, 2025
955ea31
Merge pull request #670 from tcely/resolve-upstream-main
tcely May 20, 2025
f98de4d
Add bun binary
tcely May 20, 2025
77e702e
Add uv & uvx binaries
tcely May 20, 2025
446bcce
Add deno binary
tcely May 20, 2025
4a767fd
Merge branch 'meeb:main' into test-2
tcely May 20, 2025
b6a86b5
Merge branch 'test-2' into resolve-3
tcely May 20, 2025
3b7d068
Merge pull request #671 from tcely/resolve-3
tcely May 20, 2025
cff7eb3
Combine copies from bun
tcely May 20, 2025
7bc453c
Merge pull request #672 from tcely/patch-3
tcely May 20, 2025
646d33e
Revert the previous commit as it is not working
tcely May 20, 2025
890677d
Try the build without installing `pipenv`
tcely May 20, 2025
a41d9df
Merge branch 'test-2' into resolve-3
tcely May 20, 2025
a29c4f1
Run `wormhole` using `uvx`
tcely May 20, 2025
de2652c
Merge pull request #673 from tcely/resolve-3
tcely May 20, 2025
4307d4c
Update ci.yaml
tcely May 20, 2025
1a08b75
Output `WORMHOLE_CODE`
tcely May 20, 2025
09fa4a6
Fix the logic
tcely May 20, 2025
dc717ac
Compiling needs headers
tcely May 20, 2025
fe8157d
Merge pull request #674 from tcely/patch-3
tcely May 20, 2025
e8f2a23
Install to the system with `uv`
tcely May 20, 2025
99afc8a
Adjust flags
tcely May 21, 2025
d13f4ff
`pipenv` still needs lock
tcely May 21, 2025
cca4dbe
Remove `Pipfile.lock` from the image
tcely May 21, 2025
c4b4bcd
Specify link mode as copy
tcely May 21, 2025
456ff62
Adjust verbose flags
tcely May 21, 2025
735d548
Set up caching for `uv`
tcely May 21, 2025
8d8a035
Cache `magic-wormhole` also
tcely May 21, 2025
e24d56d
Try `uv cache prune` first
tcely May 21, 2025
b678f24
Switch to `locked` for sharing
tcely May 21, 2025
353c7ea
Always use copy for the link mode
tcely May 21, 2025
d30148b
Copy from the old `uv` cache to the new `uv` cache
tcely May 21, 2025
c46ce25
Less verbose output and less aggressive pruning
tcely May 21, 2025
745fbf9
Try locked sharing
tcely May 21, 2025
3798745
Try aggressive pruning
tcely May 21, 2025
ff54112
Try without extra copy
tcely May 21, 2025
f866def
Prune the saved `uv` cache aggressively
tcely May 21, 2025
bb2ed86
Add build args for CI & `magic-wormhole`
tcely May 21, 2025
e6611f7
Invalidate the layer cache when using `magic-wormhole`
tcely May 21, 2025
94a06c2
Only prune when the `uv` cache was restored
tcely May 21, 2025
94fec24
Try nginx variant and only copy `uv`
tcely May 21, 2025
0b97b29
Update Pipfile
tcely May 21, 2025
3bf8107
Merge pull request #675 from tcely/tcely-patch-1
tcely May 21, 2025
5059fc2
Update nginx.conf
tcely May 21, 2025
2803761
Move `load_module` before `events` in nginx.conf
tcely May 21, 2025
2222a14
Merge branch 'meeb:main' into patch-2
tcely May 25, 2025
af1c1b2
Merge branch 'meeb:main' into test-2
tcely May 25, 2025
360b39e
Update `directory_and_stem` in utils.py
tcely May 25, 2025
a21098a
Use the `tubesync-openresty` stage
tcely May 25, 2025
ff23368
Use a bind mount for `uv`
tcely May 25, 2025
18e506a
Add `django-huey`
tcely May 27, 2025
3093315
Use `Metadata` table to store Source indexing results
tcely May 28, 2025
811e36a
Do not accept indexing results as media metadata
tcely May 28, 2025
2e1b96b
Write to the database in batched transactions
tcely May 28, 2025
1927b96
Manage the "Checking all media" task better
tcely May 28, 2025
db7ccea
Merge pull request #681 from tcely/patch-10
tcely May 28, 2025
7f63c99
Remove an unused import
tcely May 28, 2025
212f4fb
Create 0035_alter_metadata_unique_together_metadata_source_and_more.py
tcely May 28, 2025
595e347
Depend on 0033 temporarily
tcely May 28, 2025
d970733
Providing the `source` column is still needed
tcely May 28, 2025
0b5a475
Ignore indexed data when trying to reuse old metadata
tcely May 28, 2025
15d4a8f
Create huey.py
tcely May 29, 2025
261e179
Add `django_huey` queues to settings
tcely May 29, 2025
8d64a96
Add more configuration
tcely May 29, 2025
482d857
Create the `/config/tasks` directory
tcely May 29, 2025
16ee589
Create huey-net-limited/dependencies.d/base
tcely May 29, 2025
730e75e
Create huey-network/dependencies.d/base
tcely May 29, 2025
379d548
Create huey-database/dependencies.d/base
tcely May 29, 2025
f2afbc1
Create huey-filesystem/dependencies.d/base
tcely May 29, 2025
5c54909
Create huey-net-limited/down-signal
tcely May 29, 2025
08d593d
Create huey-network/down-signal
tcely May 29, 2025
61260fe
Create huey-database/down-signal
tcely May 29, 2025
c39491b
Create huey-filesystem/down-signal
tcely May 29, 2025
227624a
Create huey-net-limited/type
tcely May 29, 2025
c16d3fe
Create huey-network/type
tcely May 29, 2025
8b08177
Create huey-database/type
tcely May 29, 2025
7ae89b3
Create huey-filesystem/type
tcely May 29, 2025
6e5099e
Create huey-net-limited/run
tcely May 29, 2025
c115908
Create huey-network/run
tcely May 29, 2025
2b0d3db
Create huey-database/run
tcely May 29, 2025
5e22425
Create huey-filesystem/run
tcely May 29, 2025
cf27324
Merge branch 'meeb:main' into index-rewrite
tcely May 29, 2025
6aac849
Revert Depend on 0033 temporarily
tcely May 29, 2025
9fd8c7c
Merge branch 'main' into patch-6
tcely May 29, 2025
9a5acdd
Create new Media instances with defaults
tcely May 29, 2025
6b64614
Use the `Media.metadata_clear` function
tcely May 29, 2025
5e20ebd
Do not call `Media.save_to_metadata` function unless needed
tcely May 29, 2025
e21da0f
Update `Media.has_metadata`
tcely May 29, 2025
37a6044
Add `channel_id` to the minimal metadata
tcely May 29, 2025
c8f9545
Create gunicorn dependency for huey-database
tcely May 29, 2025
7078c2b
Create gunicorn dependency for huey-filesystem
tcely May 29, 2025
16b8f9a
Create gunicorn dependency for huey-network
tcely May 29, 2025
7e9be86
Create gunicorn dependency for huey-net-limited
tcely May 30, 2025
9b33606
Create background-task-workers bundle
tcely May 30, 2025
71c0ae6
Add tubesync-network-worker to background-task-workers bundle
tcely May 30, 2025
b4c14ea
Add tubesync-db-worker to background-task-workers bundle
tcely May 30, 2025
3890ad8
Add tubesync-fs-worker to background-task-workers bundle
tcely May 30, 2025
b72fc2d
Create huey-consumers bundle
tcely May 30, 2025
95181c4
Add huey-net-limited to huey-consumers bundle
tcely May 30, 2025
3c8d189
Add huey-network to huey-consumers bundle
tcely May 30, 2025
a2abe4f
Add huey-database to huey-consumers bundle
tcely May 30, 2025
a8e112b
Add huey-filesystem to huey-consumers bundle
tcely May 30, 2025
4a090ab
Add huey-consumers to user bundle
tcely May 30, 2025
894f332
Match the current version
tcely May 30, 2025
36059c0
Update ci.yaml
tcely May 30, 2025
d08bbf2
Use a symbolic link for `/config`
tcely May 30, 2025
6f5d35d
Support local settings stored in `/config/tubesync`
tcely May 30, 2025
bd06c5b
Add the rest of the `/config` sub-directories
tcely May 30, 2025
0b63d70
Make directories before creating SQLite database
tcely May 30, 2025
f561de8
Clean up any files created in Python
tcely May 30, 2025
33491ed
Only create `/config` for tests
tcely May 30, 2025
ea43d54
fixup: values instead of items
tcely May 30, 2025
98df36a
Fail the build rather than hiding the file that is in a lower layer
tcely May 30, 2025
479f36b
Add and document logging settings
tcely May 30, 2025
78a5721
Unlock previously locked tasks when the consumer starts
tcely May 30, 2025
1ac70a1
Enable `editor` in the container
tcely Jun 1, 2025
89abf8f
Add `babi` editor
tcely Jun 1, 2025
a921497
Remove the `docker pull` operations from info
tcely Jun 1, 2025
e5c19a2
Configure alternatives groups
tcely Jun 1, 2025
c1e30b7
Add the `vim` alternatives group
tcely Jun 1, 2025
8b0d3eb
Set the `EDITOR` environment variable to use the alternatives group
tcely Jun 1, 2025
133d65a
Prevent `update-alternatives` from doing the wrong thing
tcely Jun 1, 2025
e0a2aa5
Remove `thumbnail` and `nfo` logic from tasks
tcely Jun 2, 2025
6c5b8e0
Add `copy_thumbnail` and `write_nfo` functions
tcely Jun 2, 2025
c89c4ec
Import the new functions
tcely Jun 2, 2025
90329a1
De-conflict `write_nfo` naming
tcely Jun 2, 2025
73cb339
Call the newly renamed function from tasks.py
tcely Jun 2, 2025
ca5f9a4
Rename the function definition
tcely Jun 2, 2025
d28ddd7
Adjust the import
tcely Jun 2, 2025
98bca72
fixup: dependencies
tcely Jun 2, 2025
a402339
fixup: `ruff check` complaints
tcely Jun 2, 2025
284cc16
fixup: remove the now unused import
tcely Jun 2, 2025
be404d0
fixup: add the missing import
tcely Jun 2, 2025
4e4c813
Merge branch 'meeb:main' into patch-2
tcely Jun 2, 2025
6d04d77
Remove `glob_quote` from sync/utils.py
tcely Jun 2, 2025
dbd30e6
Adjust the `glob_quote` import in sync/signals.py
tcely Jun 2, 2025
c7e8c97
Adjust the `glob_quote` import in sync/media.py
tcely Jun 2, 2025
7b23d3b
Remove `seconds_to_timestr` from sync/utils.py
tcely Jun 2, 2025
2c67b2f
Adjust the `seconds_to_timestr` import in sync/tasks.py
tcely Jun 2, 2025
db7af44
Adjust the `seconds_to_timestr` import in sync/media.py
tcely Jun 2, 2025
8852c8c
Switch to the `common.utils` version
tcely Jun 2, 2025
8b127af
Remove the old copy from sync/models/_private.py
tcely Jun 2, 2025
432bc01
fixup: remove an unused import
tcely Jun 2, 2025
dc0edef
Remove `list_of_dictionaries` from sync/utils.py
tcely Jun 2, 2025
f097b6b
Remove `mkdir_p` from sync/utils.py
tcely Jun 2, 2025
0be0aa9
Adjust the `mkdir_p` import in sync/models/media.py
tcely Jun 2, 2025
ff30543
Adjust the `mkdir_p` import in sync/signals.py
tcely Jun 2, 2025
fbb27ea
Adjust the `mkdir_p` import in sync/views.py
tcely Jun 2, 2025
021988f
Adjust the `mkdir_p` import in sync/youtube.py
tcely Jun 2, 2025
1afe0d4
Adjust the `multi_key_sort` import in sync/matching.py
tcely Jun 2, 2025
64cd082
Remove `multi_key_sort` from sync/utils.py
tcely Jun 2, 2025
decbe14
Adjust the `multi_key_sort` import in sync/models/media.py
tcely Jun 2, 2025
ae1974b
Adjust the `multi_key_sort` import in sync/views.py
tcely Jun 2, 2025
659e46a
fixup: remove unused imports
tcely Jun 2, 2025
60aafbd
fixup: accept the existing calls
tcely Jun 2, 2025
54aa509
Migrate data from indexing to metadata in a task
tcely Jun 3, 2025
997ce66
Merge branch 'test-2' into resolve-upstream-main
tcely Jun 3, 2025
38ddfba
Merge pull request #689 from tcely/resolve-upstream-main
tcely Jun 3, 2025
f50132c
Merge pull request #690 from tcely/patch-4
tcely Jun 3, 2025
739bb7d
Merge pull request #691 from tcely/patch-2
tcely Jun 3, 2025
3570854
Merge branch 'test-2' into patch-7
tcely Jun 3, 2025
597d957
Merge pull request #692 from tcely/patch-7
tcely Jun 3, 2025
5fd60f7
Merge pull request #693 from tcely/patch-10
tcely Jun 3, 2025
cec0f60
Merge pull request #694 from tcely/patch-6
tcely Jun 3, 2025
086374c
Merge branch 'test-2' into resolve
tcely Jun 3, 2025
da98678
Merge pull request #695 from tcely/resolve
tcely Jun 3, 2025
3fc2b09
Remove the `python3-lib` alternative
tcely Jun 3, 2025
2f9d312
Merge pull request #696 from tcely/patch-10
tcely Jun 3, 2025
f74c22c
fixup: building from source on arm64
tcely Jun 3, 2025
46d2427
Merge pull request #697 from tcely/patch-10
tcely Jun 3, 2025
26b9ead
Try without these packages
tcely Jun 3, 2025
f998a48
Check for "not found" in `ldd` output
tcely Jun 3, 2025
28916bb
Fail the build for "not found"
tcely Jun 3, 2025
16af042
Restore `libmariadb3` to Dockerfile
tcely Jun 3, 2025
1bc0a23
Add `libonig5` to Dockerfile
tcely Jun 3, 2025
18ff1b2
Clean up `jq` code
tcely Jun 4, 2025
7e43c55
Use the newer functions
tcely Jun 4, 2025
93adc59
Wait on database tasks and add verbose names to the new tasks
tcely Jun 4, 2025
446a70c
Merge pull request #698 from tcely/index-rewrite
tcely Jun 4, 2025
3c85d55
Re-work the re-use of old metadata after deletion
tcely Jun 5, 2025
4beec34
Merge pull request #699 from tcely/patch-13
tcely Jun 5, 2025
5874619
Delay `save_all_media_for_source` while database tasks run
tcely Jun 5, 2025
2dae3b0
Delay additional indexing tasks while database tasks run
tcely Jun 5, 2025
69d03e4
Merge pull request #700 from tcely/index-rewrite
tcely Jun 5, 2025
2fef103
Don't remove based on `task_hash`
tcely Jun 5, 2025
4cffc94
Retry the task when the queue worker is stopped
tcely Jun 6, 2025
687957f
Add `BgTaskWorkerError` exception
tcely Jun 6, 2025
7b96b33
Use the new `BgTaskWorkerError` exception
tcely Jun 6, 2025
0db92bd
Merge pull request #701 from tcely/index-rewrite
tcely Jun 6, 2025
ce2dd7b
Handle multiple matches for metadata when searching by key
tcely Jun 7, 2025
28c33f0
Merge pull request #702 from tcely/patch-13
tcely Jun 7, 2025
af4f242
Use `timedelta` to avoid `ValueError`
tcely Jun 7, 2025
7e49665
Merge pull request #703 from tcely/patch-14
tcely Jun 7, 2025
3c5cd48
Add `timedelta` filter
tcely Jun 8, 2025
5838ed5
fixup: remove white-space
tcely Jun 8, 2025
54932f4
By default, display years and days only when needed
tcely Jun 8, 2025
9575185
fixup: set a default value for the local
tcely Jun 8, 2025
4f79e64
fixup: use the correct variable
tcely Jun 8, 2025
60b624c
Merge pull request #704 from tcely/patch-15
tcely Jun 8, 2025
0dfaaaf
Display locked time for tasks
tcely Jun 8, 2025
dade558
Merge pull request #706 from tcely/tasks-locked-time
tcely Jun 8, 2025
ac34dab
Resolve bundles in restart_services.sh
tcely Jun 9, 2025
2aadc48
Merge pull request #707 from tcely/patch-16
tcely Jun 9, 2025
032bd15
fixup: missed a dir => _dir change
tcely Jun 9, 2025
04bf342
Merge pull request #708 from tcely/patch-16
tcely Jun 9, 2025
1fd3229
Use f-string for logged message
tcely Jun 9, 2025
5478dbf
Use f-string for logged messages
tcely Jun 9, 2025
f8d4b8b
Merge pull request #709 from tcely/patch-13
tcely Jun 9, 2025
49dcbee
Merge pull request #710 from tcely/patch-7
tcely Jun 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 192 additions & 25 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
pull_request:
branches:
- 'main'
- 'test-*'
types:
- opened
- reopened
Expand Down Expand Up @@ -41,24 +42,6 @@ jobs:
set_sl_var() { local f='%s=%s\n' ; printf -- "${f}" "$@" ; } ;
set -eux
set_sl_var image "${image}" >> "${GITHUB_OUTPUT}"
# v0.14.1 = ghcr.io/meeb/tubesync:latest@sha256:63fffee3411bda395c526087d7107f76834141bb0c1443a0bd6bed5533e5a85f
tag_tried='v0.14.1'
tag_image_digest='latest@sha256:63fffee3411bda395c526087d7107f76834141bb0c1443a0bd6bed5533e5a85f'
docker pull "${image}:${tag_image_digest}"
docker pull "${image}:${tag_tried}" && tag_found=1 || {
tag_found=0
missing="${missing}${missing:+|}${tag_tried}=${image}:${tag_image_digest}"
}
set_sl_var "${tag_tried}" "${tag_found}" >> "${GITHUB_OUTPUT}"
# v0.15.1 = ghcr.io/meeb/tubesync:latest@sha256:7303b2d8854aac15f94dbbfdd0ee66ca598ade1af6ac2d9e3d886c93ffa2d596
tag_tried='v0.15.1'
tag_image_digest='latest@sha256:7303b2d8854aac15f94dbbfdd0ee66ca598ade1af6ac2d9e3d886c93ffa2d596'
docker pull "${image}:${tag_image_digest}"
docker pull "${image}:${tag_tried}" && tag_found=1 || {
tag_found=0
missing="${missing}${missing:+|}${tag_tried}=${image}:${tag_image_digest}"
}
set_sl_var "${tag_tried}" "${tag_found}" >> "${GITHUB_OUTPUT}"
set_sl_var missing "${missing}" >> "${GITHUB_OUTPUT}"
- uses: actions/checkout@v4
- name: Lowercase github username
Expand Down Expand Up @@ -132,6 +115,8 @@ jobs:
pip install --system --strict --requirements requirements.txt
- name: Set up Django environment
run: |
mkdir -v -p ~/.config/TubeSync/config
sudo ln -v -s -f -T ~/.config/TubeSync/config /config
cp -v -p tubesync/tubesync/local_settings.py.example tubesync/tubesync/local_settings.py
cp -v -a -t "${Python3_ROOT_DIR}"/lib/python3.*/site-packages/background_task/ patches/background_task/*
cp -v -a -t "${Python3_ROOT_DIR}"/lib/python3.*/site-packages/yt_dlp/ patches/yt_dlp/*
Expand Down Expand Up @@ -185,7 +170,94 @@ jobs:
needs: ['info', 'test']
runs-on: ubuntu-latest
timeout-minutes: 120
services:
wormhole-mailbox:
image: 'ghcr.io/tcely/docker-magic-wormhole-mailbox-server:service'
ports:
- '4000:4000'
wormhole-transit:
image: 'ghcr.io/tcely/docker-magic-wormhole-transit-relay:main'
ports:
- '4001:4001'
steps:
- name: Set environment variables with jq
run: |
# jq
cat >| .ffmpeg.releases.json <<'EOF'
${{ needs.info.outputs.ffmpeg-releases }}
EOF

FFMPEG_DATE='[foreach .[] as $release ([{}, []]; [ .[0] + { ($release.commit): ([ $release.date ] + (.[0][($release.commit)] // [])) }, [ .[1][0] // $release.commit ] ] ; .[0][(.[1][0])] )][-1][0]' ;
FFMPEG_VERSION='.[]|select(.date == $previous)|.versions[]|select(startswith("N-"))' ;

mk_delim() { printf -- '"%s_EOF_%d_"' "$1" "${RANDOM}" ; } ;
open_ml_var() { local f=''\%'s<<'\%'s\n' ; printf -- "${f}" "$2" "$1" ; } ;
close_ml_var() { local f='%s\n' ; printf -- "${f}" "$1" ; } ;
{
for var in FFMPEG_DATE FFMPEG_VERSION
do
# jq_arg="$( eval printf -- "'%s\n'" "$(printf -- '"${%s}"' "${var}")" )" ;
jq_arg="$( eval printf -- "'%s\n'" '"${'"${var}"'}"' )" ;
delim="$(mk_delim "${var}")" ;
open_ml_var "${delim}" "${var}" ;
jq -r --arg previous "${previous_value-}" "${jq_arg}" -- .ffmpeg.releases.json ;
close_ml_var "${delim}" "${var}" ;
previous_value="$( jq -r --arg previous "${previous_value-}" "${jq_arg}" -- .ffmpeg.releases.json )" ;
done ;

unset -v delim jq_arg previous_value var ;
} >> "${GITHUB_ENV}"
rm -v -f .ffmpeg.releases.json
- name: Set environment variables with GitHub CLI
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# gh api
GH_UPSTREAM_OWNER='.parent.owner.login' ;
GH_UPSTREAM_REPO='.parent.name' ;
GH_UPSTREAM_SLUG='.parent.full_name' ;

mk_delim() { printf -- '"%s_EOF_%d_"' "$1" "${RANDOM}" ; } ;
open_ml_var() { local f=''\%'s<<'\%'s\n' ; printf -- "${f}" "$2" "$1" ; } ;
close_ml_var() { local f='%s\n' ; printf -- "${f}" "$1" ; } ;
{
for var in GH_UPSTREAM_OWNER # GH_UPSTREAM_REPO GH_UPSTREAM_SLUG
do
# jq_arg="$( eval printf -- "'%s\n'" "$(printf -- '"${%s}"' "${var}")" )" ;
jq_arg="$( eval printf -- "'%s\n'" '"${'"${var}"'}"' )" ;
delim="$(mk_delim "${var}")" ;
open_ml_var "${delim}" "${var}" ;
gh api "repos/${GITHUB_REPOSITORY}" --cache 1h --jq "${jq_arg}" ;
close_ml_var "${delim}" "${var}" ;
done ;
unset -v delim jq_arg var ;
} >> "${GITHUB_ENV}"

# Delete the oldest unused cache entries
printf -- '%s\n' 'Deleting unused cache entries' ;
gh cache list --sort last_accessed_at --order asc --ref "${GITHUB_REF}" | \
awk '$NF == $(NF-1) {print $1}' | \
xargs -r -t -n 1 gh cache delete 2>&1 | \
tee /dev/stderr | wc -l | xargs -n 1 printf -- 'Total deleted: %d\n' ;
- name: Upstream registry ref
id: upstream
run: |
user_lowercase="$(printf -- '%s\n' "${GH_UPSTREAM_OWNER}" | awk '{print tolower($0);}')" ;
repo_image="ghcr.io/${user_lowercase}/${IMAGE_NAME}"
set_sl_var() { local f='%s=%s\n' ; printf -- "${f}" "$@" ; } ;
set_sl_var >> "${GITHUB_OUTPUT}" \
ref "${repo_image}:latest" \
tag "${repo_image}:latest" ;
- name: Registry ref
id: origin
run: |
user_lowercase="$(printf -- '%s\n' "${GITHUB_ACTOR}" | awk '{print tolower($0);}')" ;
repo_image="ghcr.io/${user_lowercase}/${IMAGE_NAME}"
set_sl_var() { local f='%s=%s\n' ; printf -- "${f}" "$@" ; } ;
set_sl_var >> "${GITHUB_OUTPUT}" \
ref "${repo_image}:cache" \
tag "${repo_image}:latest" ;
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -198,7 +270,7 @@ jobs:
DOCKER_TOKEN: ${{ 'meeb' == github.repository_owner && secrets.REGISTRY_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
run: echo "${DOCKER_TOKEN}" | docker login --password-stdin --username "${DOCKER_USERNAME}" "${DOCKER_REGISTRY}"
- name: Push missing release tags
if: ${{ 'meeb' == github.actor && github.actor == github.repository_owner && '' != needs.info.outputs.missing-tags }}
if: ${{ false && 'meeb' == github.actor && github.actor == github.repository_owner && '' != needs.info.outputs.missing-tags }}
run: |
missing='${{ needs.info.outputs.missing-tags }}'
image='${{ needs.info.outputs.missing-tags-image }}'
Expand All @@ -212,15 +284,97 @@ jobs:
docker push "${image}:${tag}" ;
)
done
- name: Checkout
uses: actions/checkout@v4
- name: Create cache directory on the runner
run: |
mkdir -v -p .cache
: >> .cache/reset
mkdir -v .cache/saved .cache/removed .cache/runner
- name: Cache from tubesync stage
id: cache
uses: actions/cache@v4
with:
path: |
.cache/saved
.cache/runner
key: docker-cache-tubesync-${{ hashFiles('.cache/reset') }}-${{ hashFiles('*file', '.github/workflows/ci.yaml') }}
restore-keys: |
docker-cache-tubesync-${{ hashFiles('.cache/reset') }}-
- name: List cache directory on the runner
run: |
# limited listing when the cache was restored
ls -al .cache &&
ls -al .cache/* &&
ls -al .cache/*/* &&
ls -al .cache/*/*/* ||
ls -alR .cache
- name: Start magic-wormhole services on the runner
if: ${{ 'true' != steps.cache.outputs.cache-hit }}
id: wormhole
run: |
rm -rf .cache/runner/wormhole
sudo apt-get install python3-venv
venv_dir=".cache/runner/${RUNNER_ARCH}/wormhole" &&
python3 -m venv --upgrade-deps "${venv_dir}" &&
. "${venv_dir}"/bin/activate || exit
pip install 'magic-wormhole'
# determine the runner IP address
_awk_prog='$0 !~ /scope host/ && "inet" == $1 {split($2, P, "/"); print P[1]; exit;}'
runner_ip="$( ip addr sh | awk "${_awk_prog}" )"
# set variables
relay_arg="ws://${runner_ip}:4000/v1"
transit_arg="tcp:[${runner_ip}]:4001"
# generate the code and receive the first transfer
( wormhole \
--appid TubeSync \
--relay-url "${relay_arg}" \
--transit-helper "${transit_arg}" \
receive -a -c 3 \
--accept-file -o .cache/incoming >| .cache/receive.out 2>&1 && \
mv --backup=numbered -f .cache/incoming/* .cache/saved/ || : ; \
mv --backup=numbered -f .cache/saved/*.~[0-9]~ .cache/removed/ || : ; ) &
_pid=$!; sleep 1 && grep -e '^Allocated code:' .cache/receive.out | cut -d ' ' -f 3- >| .cache/.wormhole-code
cat -v -n .cache/receive.out
rm -v -f .cache/receive.out
code="$(< .cache/.wormhole-code)"
rm -v -f .cache/.wormhole-code
# create output variables
printf -- '%s=%s\n' >> "$GITHUB_OUTPUT" \
code "${code}" \
relay "${relay_arg}" \
runner_ip "${runner_ip}" \
transit "${transit_arg}" ;
# receive the saved directories
( cd .cache &&
while test -d /proc/"${_pid}" ; do sleep 5 ; done &&
while { \
wormhole \
--appid TubeSync \
--relay-url "${relay_arg}" \
--transit-helper "${transit_arg}" \
receive \
--accept-file -o incoming "${code}" || : ; \
}
do
mv --backup=numbered -f incoming/* saved/ || : ;
mv --backup=numbered -f saved/*.~[0-9]~ removed/ || : ;
rm -rf removed/* || : ;
done &)
- name: Build image for `dive`
id: build-dive-image
uses: docker/build-push-action@v6
with:
build-args: |
CI=${{ env.CI }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
FFMPEG_DATE=${{ needs.info.outputs.ffmpeg-date }}
FFMPEG_VERSION=${{ needs.info.outputs.ffmpeg-version }}
YTDLP_DATE=${{ fromJSON(needs.info.outputs.ytdlp-latest-release).tag.name }}
WORMHOLE_RELAY=${{ env.WORMHOLE_RELAY }}
WORMHOLE_TRANSIT=${{ env.WORMHOLE_TRANSIT }}
build-contexts: |
cache-tubesync=.cache/saved
cache-from: type=gha
load: true
platforms: linux/amd64
Expand All @@ -238,21 +392,34 @@ jobs:
--highestWastedBytes '50M'
- name: Build and push
id: build-push
timeout-minutes: 60
timeout-minutes: 90
uses: docker/build-push-action@v6
env:
WORMHOLE_CODE: ${{ steps.wormhole.outputs.code }}
WORMHOLE_RELAY: ${{ steps.wormhole.outputs.relay }}
WORMHOLE_TRANSIT: ${{ steps.wormhole.outputs.transit }}
with:
platforms: linux/amd64,linux/arm64
push: ${{ 'success' == needs.test.result && 'meeb' == github.repository_owner && 'pull_request' != github.event_name && 'true' || 'false' }}
tags: ghcr.io/${{ needs.info.outputs.lowercase-github-actor }}/${{ env.IMAGE_NAME }}:latest
push: ${{ 'success' == needs.test.result && 'pull_request' != github.event_name && 'true' || 'false' }}
provenance: false
tags: ${{ steps.origin.outputs.tag }}
cache-from: |
type=registry,ref=ghcr.io/${{ needs.info.outputs.lowercase-github-actor }}/${{ env.IMAGE_NAME }}:latest
type=registry,ref=ghcr.io/${{ needs.info.outputs.lowercase-github-repository_owner }}/${{ env.IMAGE_NAME }}:latest
type=gha
type=registry,ref=${{ steps.origin.outputs.ref }}
type=registry,ref=${{ steps.upstream.outputs.ref }}
cache-to: |
type=gha,mode=max
${{ 'meeb' == github.repository_owner && 'pull_request' != github.event_name && 'type=inline' || '' }}
build-args: |
CI=${{ env.CI }}
IMAGE_NAME=${{ env.IMAGE_NAME }}
FFMPEG_DATE=${{ needs.info.outputs.ffmpeg-date }}
FFMPEG_VERSION=${{ needs.info.outputs.ffmpeg-version }}
YTDLP_DATE=${{ fromJSON(needs.info.outputs.ytdlp-latest-release).tag.name }}
WORMHOLE_RELAY=${{ env.WORMHOLE_RELAY }}
WORMHOLE_TRANSIT=${{ env.WORMHOLE_TRANSIT }}
build-contexts: |
cache-tubesync=.cache/saved
secret-envs: |
WORMHOLE_CODE=WORMHOLE_CODE
WORMHOLE_RELAY=WORMHOLE_RELAY
WORMHOLE_TRANSIT=WORMHOLE_TRANSIT
Loading