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