forked from shinchiro/mpv-winbuild-cmake
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c153bc
commit 8ddbe54
Showing
16 changed files
with
315 additions
and
1,733 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,6 @@ on: | |
description: 'Run custom command before building' | ||
required: false | ||
type: string | ||
sourceforge: | ||
description: 'Upload to Sourceforge' | ||
required: false | ||
default: false | ||
type: boolean | ||
github_release: | ||
description: 'Upload to Github release' | ||
required: false | ||
|
@@ -121,11 +116,6 @@ jobs: | |
ninja -C build_$BIT mpv-packaging; mv build_$BIT/mpv*.7z release_$BIT | ||
if [[ $BIT == x86_64_v3 ]]; then for dir in release_$BIT/mpv-*; do name=$(basename $dir); mv $dir $(dirname $dir)/${name/x86_64/x86_64-v3}; done; fi | ||
- name: Copying ffmpeg | ||
run: | | ||
hash=$(git -C src_packages/ffmpeg rev-parse --short HEAD) | ||
7z a -m0=lzma2 -mx=9 -ms=on release_$BIT/ffmpeg-${{ env.arch }}${{ env.x86_64_level }}-git-$hash.7z ./build_$BIT/$BIT-w64-mingw32/bin/ffmpeg.exe | ||
- name: Collecting logs | ||
if: always() | ||
run: | | ||
|
@@ -250,116 +240,22 @@ jobs: | |
mv release_i686/* release_x86_64/* release_x86_64_v3/* release_aarch64/* release | ||
du -ah release/* | ||
- name: Uploading packages to Sourceforge | ||
id: upload_packages_sf | ||
if: ${{ github.event.inputs.sourceforge == 'true' }} | ||
continue-on-error: true | ||
env: | ||
MPV_VER: ${{ needs.build_mpv.outputs.mpv_ver }} | ||
run: | | ||
mkdir -p /root/.ssh/ | ||
echo "${{ secrets.SF_PRIVATE_KEY }}" > sf_key | ||
pubkey=$(cat <<END | ||
frs.sourceforge.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOQD35Ujalhh+JJkPvMckDlhu4dS7WH6NsOJ15iGCJLC | ||
END | ||
) | ||
echo $pubkey > /root/.ssh/known_hosts | ||
chmod 400 sf_key | ||
chmod -R 700 /root | ||
sftp -i sf_key [email protected]:/home/frs/project/mpv-player-windows <<END | ||
put release/mpv-dev* libmpv | ||
put release/mpv-i686* 32bit | ||
put release/mpv-x86_64-[!v3]* 64bit | ||
put release/mpv-x86_64-v3* 64bit-v3 | ||
put release/mpv-$MPV_VER* release | ||
END | ||
- name: Uploading packages to Github release | ||
id: upload_packages_gh | ||
if: ${{ github.event.inputs.github_release == 'true' && github.event.inputs.mpv_tarball == 'false' }} | ||
continue-on-error: true | ||
run: | | ||
short_date=$(date "+%Y%m%d") | ||
body=$(cat <<END | ||
![GitHub release (by tag)](https://img.shields.io/github/downloads/shinchiro/mpv-winbuild-cmake/$short_date/total?label=Downloads) | ||
**Workflow run**: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID | ||
END | ||
) | ||
id=$(curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases -d @- <<END | jq -r '.id' | ||
id=$(curl -u media-kit:$GH_TOKEN $CURL_RETRIES -s -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/media-kit/libmpv-win32-video-cmake/releases -d @- <<END | jq -r '.id' | ||
{ | ||
"tag_name": "$short_date", | ||
"name": "$short_date", | ||
"body": "$(echo ${body//$'\n'/'\n'})" | ||
} | ||
END | ||
) | ||
for file in release/*.7z; do curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -X POST -H "Accept: application/vnd.github.v3+json" -H "Content-Type: $(file -b --mime-type $file)" https://uploads.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/$id/assets?name=$(basename $file) --data-binary @$file; done | ||
- name: Pruning tags | ||
continue-on-error: true | ||
run: | | ||
# Keep latest 30 tags/releases | ||
git fetch --tags | ||
tag_list=($(git tag | sort -r)) | ||
old=${tag_list[@]:30} | ||
for tag in ${old[@]}; do | ||
id=$(curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -X GET -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/tags/$tag | jq -r '.id') | ||
curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/$id | ||
git tag -d $tag | ||
done | ||
git push --tags --prune https://shinchiro:[email protected]/shinchiro/mpv-winbuild-cmake | ||
- name: Delete releases cache | ||
if: ${{ github.event.inputs.github_release == 'false' || steps.upload_packages_gh.outcome == 'success' }} | ||
run: | | ||
curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -o /dev/null -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/caches?key=$release_i686_key | ||
curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -o /dev/null -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/caches?key=$release_x86_64_key | ||
curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -o /dev/null -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/caches?key=$release_x86_64_v3_key | ||
curl -u shinchiro:$GH_TOKEN $CURL_RETRIES -s -o /dev/null -X DELETE -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/caches?key=$release_aarch64_key | ||
call_workflow: | ||
name: Run mpv_gcc | ||
runs-on: ubuntu-latest | ||
needs: build_mpv | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
GH_COMMAND: ${{ github.event.inputs.command }} | ||
steps: | ||
- name: Run mpv_gcc.yml | ||
run: | | ||
curl -u shinchiro:$GH_TOKEN -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/workflows/mpv_gcc.yml/dispatches -d @- <<EOF | ||
{ | ||
"ref": "master", | ||
"inputs": { | ||
"sourceforge": "false", | ||
"github_release": "true", | ||
"mpv_tarball": "false", | ||
"command": "$GH_COMMAND" | ||
} | ||
} | ||
EOF | ||
gist: | ||
name: Gist | ||
runs-on: ubuntu-latest | ||
needs: build_mpv | ||
if: ${{ always() }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GIST_TOKEN }} | ||
RUN_ID: ${{ github.run_id }} | ||
steps: | ||
- name: Setup git credentials | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Upload job logs to gist | ||
run: | | ||
url=$(curl -su shinchiro:$GH_TOKEN -X GET -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/runs/$RUN_ID/jobs | jq -r '.jobs[0] | .url') | ||
curl -sLu shinchiro:$GH_TOKEN -X GET -H "Accept: application/vnd.github.v3+json" $url/logs -o mpv_log | ||
git clone --depth 1 https://shinchiro:[email protected]/90308c6632c9010d03b325c9ca6a4b6f job_log | ||
cp -f mpv_log job_log/mpv_log | ||
git -C job_log add . | ||
git -C job_log commit --amend --no-edit | ||
git -C job_log push -f https://shinchiro:[email protected]/90308c6632c9010d03b325c9ca6a4b6f | ||
for file in release/*.7z; do curl -u media-kit:$GH_TOKEN $CURL_RETRIES -X POST -H "Accept: application/vnd.github.v3+json" -H "Content-Type: $(file -b --mime-type $file)" https://uploads.github.com/repos/media-kit/libmpv-win32-video-cmake/releases/$id/assets?name=$(basename $file) --data-binary @$file; done |
Oops, something went wrong.