Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c428afd80b | |||
| 3fa77f1524 | |||
| c0f946fd51 |
@@ -15,16 +15,30 @@ jobs:
|
||||
GITEA_SHA: ${{ github.sha }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://git.jc2009.com/admin/actions-checkout@v4
|
||||
- name: Clone repository
|
||||
run: |
|
||||
set -e
|
||||
|
||||
rm -rf repo
|
||||
git clone https://git.jc2009.com/client-commons/media-assets.git repo
|
||||
cd repo
|
||||
git rev-parse HEAD
|
||||
|
||||
echo "Music files after clone:"
|
||||
find music -type f -name "*.mp3" -exec ls -lh {} \;
|
||||
|
||||
echo "MP3 file headers:"
|
||||
find music -type f -name "*.mp3" -exec sh -c 'echo "---- $1"; head -c 80 "$1"; echo' _ {} \;
|
||||
|
||||
- name: Show workspace
|
||||
working-directory: repo
|
||||
run: |
|
||||
pwd
|
||||
ls -la
|
||||
find . -maxdepth 2 -type f | sort | head -80
|
||||
|
||||
- name: Build stable zip
|
||||
working-directory: repo
|
||||
run: |
|
||||
set -e
|
||||
|
||||
@@ -58,6 +72,7 @@ jobs:
|
||||
ls -lh dist/media-assets.zip
|
||||
|
||||
- name: Publish stable release asset
|
||||
working-directory: repo
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
|
||||
@@ -119,8 +119,8 @@ def _list_release_assets(api_base: str, token: str, release_id: int) -> list[dic
|
||||
return assets
|
||||
|
||||
|
||||
def _delete_asset(api_base: str, token: str, asset_id: int) -> None:
|
||||
url = f"{api_base}/releases/assets/{asset_id}"
|
||||
def _delete_asset(api_base: str, token: str, release_id: int, asset_id: int) -> None:
|
||||
url = f"{api_base}/releases/{release_id}/assets/{asset_id}"
|
||||
status, body = _request("DELETE", url, token)
|
||||
if status >= 400:
|
||||
_fail(f"failed to delete asset {asset_id}", status=status, body=body)
|
||||
@@ -213,7 +213,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
if asset.get("name") == args.asset_name:
|
||||
asset_id = int(asset["id"])
|
||||
print(f"Deleting existing asset {args.asset_name} (id={asset_id})...")
|
||||
_delete_asset(api_base, token, asset_id)
|
||||
_delete_asset(api_base, token, release_id, asset_id)
|
||||
|
||||
print(f"Uploading {file_path} as {args.asset_name}...")
|
||||
uploaded = _upload_asset(
|
||||
|
||||
Reference in New Issue
Block a user