2023-03-03 17:03:12 +00:00
|
|
|
name: Publish
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
2023-05-20 16:08:50 +00:00
|
|
|
channel:
|
|
|
|
default: stable
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-03-03 17:03:12 +00:00
|
|
|
version:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
target_commitish:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-05-20 16:08:50 +00:00
|
|
|
prerelease:
|
|
|
|
default: false
|
|
|
|
required: true
|
|
|
|
type: boolean
|
2023-03-03 17:03:12 +00:00
|
|
|
secrets:
|
|
|
|
ARCHIVE_REPO_TOKEN:
|
|
|
|
required: false
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Generate release notes
|
|
|
|
run: |
|
2023-05-20 16:08:50 +00:00
|
|
|
printf '%s' \
|
|
|
|
'[![Installation](https://img.shields.io/badge/-Which%20file%20should%20I%20download%3F-white.svg?style=for-the-badge)]' \
|
|
|
|
'(https://github.com/yt-dlp/yt-dlp#installation "Installation instructions") ' \
|
|
|
|
'[![Documentation](https://img.shields.io/badge/-Docs-brightgreen.svg?style=for-the-badge&logo=GitBook&labelColor=555555)]' \
|
|
|
|
'(https://github.com/yt-dlp/yt-dlp/tree/2023.03.04#readme "Documentation") ' \
|
|
|
|
'[![Donate](https://img.shields.io/badge/_-Donate-red.svg?logo=githubsponsors&labelColor=555555&style=for-the-badge)]' \
|
|
|
|
'(https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators "Donate") ' \
|
|
|
|
'[![Discord](https://img.shields.io/discord/807245652072857610?color=blue&labelColor=555555&label=&logo=discord&style=for-the-badge)]' \
|
|
|
|
'(https://discord.gg/H5MNcFW63r "Discord") ' \
|
|
|
|
${{ inputs.channel != 'nightly' && '"[![Nightly](https://img.shields.io/badge/Get%20nightly%20builds-purple.svg?style=for-the-badge)]" \
|
|
|
|
"(https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latest \"Nightly builds\")"' || '' }} \
|
|
|
|
> ./RELEASE_NOTES
|
|
|
|
printf '\n\n' >> ./RELEASE_NOTES
|
2023-03-03 17:03:12 +00:00
|
|
|
cat >> ./RELEASE_NOTES << EOF
|
|
|
|
#### A description of the various files are in the [README](https://github.com/yt-dlp/yt-dlp#release-files)
|
|
|
|
---
|
|
|
|
<details><summary><h3>Changelog</h3></summary>
|
|
|
|
$(python ./devscripts/make_changelog.py -vv)
|
|
|
|
</details>
|
|
|
|
EOF
|
2023-05-20 16:08:50 +00:00
|
|
|
printf '%s\n\n' '**This is an automated nightly pre-release build**' >> ./NIGHTLY_NOTES
|
|
|
|
cat ./RELEASE_NOTES >> ./NIGHTLY_NOTES
|
|
|
|
printf '%s\n\n' 'Generated from: https://github.com/${{ github.repository }}/commit/${{ inputs.target_commitish }}' >> ./ARCHIVE_NOTES
|
2023-03-03 17:03:12 +00:00
|
|
|
cat ./RELEASE_NOTES >> ./ARCHIVE_NOTES
|
|
|
|
|
|
|
|
- name: Archive nightly release
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.ARCHIVE_REPO_TOKEN }}
|
|
|
|
GH_REPO: ${{ vars.ARCHIVE_REPO }}
|
|
|
|
if: |
|
2023-05-20 16:08:50 +00:00
|
|
|
inputs.channel == 'nightly' && env.GH_TOKEN != '' && env.GH_REPO != ''
|
2023-03-03 17:03:12 +00:00
|
|
|
run: |
|
|
|
|
gh release create \
|
|
|
|
--notes-file ARCHIVE_NOTES \
|
2023-03-04 13:18:24 +00:00
|
|
|
--title "yt-dlp nightly ${{ inputs.version }}" \
|
2023-03-03 17:03:12 +00:00
|
|
|
${{ inputs.version }} \
|
|
|
|
artifact/*
|
|
|
|
|
|
|
|
- name: Prune old nightly release
|
2023-05-20 16:08:50 +00:00
|
|
|
if: inputs.channel == 'nightly' && !vars.ARCHIVE_REPO
|
2023-03-03 17:03:12 +00:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
run: |
|
|
|
|
gh release delete --yes --cleanup-tag "nightly" || true
|
|
|
|
git tag --delete "nightly" || true
|
|
|
|
sleep 5 # Enough time to cover deletion race condition
|
|
|
|
|
2023-05-20 16:08:50 +00:00
|
|
|
- name: Publish release${{ inputs.channel == 'nightly' && ' (nightly)' || '' }}
|
2023-03-03 17:03:12 +00:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ github.token }}
|
2023-05-20 16:08:50 +00:00
|
|
|
if: (inputs.channel == 'nightly' && !vars.ARCHIVE_REPO) || inputs.channel != 'nightly'
|
2023-03-03 17:03:12 +00:00
|
|
|
run: |
|
|
|
|
gh release create \
|
2023-05-20 16:08:50 +00:00
|
|
|
--notes-file ${{ inputs.channel == 'nightly' && 'NIGHTLY_NOTES' || 'RELEASE_NOTES' }} \
|
2023-03-03 17:03:12 +00:00
|
|
|
--target ${{ inputs.target_commitish }} \
|
2023-05-20 16:08:50 +00:00
|
|
|
--title "yt-dlp ${{ inputs.channel == 'nightly' && 'nightly ' || '' }}${{ inputs.version }}" \
|
|
|
|
${{ inputs.prerelease && '--prerelease' || '' }} \
|
|
|
|
${{ inputs.channel == 'nightly' && '"nightly"' || inputs.version }} \
|
2023-03-03 17:03:12 +00:00
|
|
|
artifact/*
|