]> jfr.im git - yt-dlp.git/blobdiff - .github/workflows/publish.yml
[build] Various build workflow improvements
[yt-dlp.git] / .github / workflows / publish.yml
index 8a1bd9a0109c49c25919a460f1ea5135515ef2bd..3ca5c699246233294c04d95df63d077735b25a5f 100644 (file)
@@ -2,16 +2,20 @@ name: Publish
 on:
   workflow_call:
     inputs:
-      nightly:
-        default: false
-        required: false
-        type: boolean
+      channel:
+        default: stable
+        required: true
+        type: string
       version:
         required: true
         type: string
       target_commitish:
         required: true
         type: string
+      prerelease:
+        default: false
+        required: true
+        type: boolean
     secrets:
       ARCHIVE_REPO_TOKEN:
         required: false
@@ -34,6 +38,19 @@ jobs:
 
       - name: Generate release notes
         run: |
+          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
           cat >> ./RELEASE_NOTES << EOF
           #### A description of the various files are in the [README](https://github.com/yt-dlp/yt-dlp#release-files)
           ---
@@ -41,9 +58,9 @@ jobs:
           $(python ./devscripts/make_changelog.py -vv)
           </details>
           EOF
-          echo "**This is an automated nightly pre-release build**" >> ./PRERELEASE_NOTES
-          cat ./RELEASE_NOTES >> ./PRERELEASE_NOTES
-          echo "Generated from: https://github.com/${{ github.repository }}/commit/${{ inputs.target_commitish }}" >> ./ARCHIVE_NOTES
+          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
           cat ./RELEASE_NOTES >> ./ARCHIVE_NOTES
 
       - name: Archive nightly release
@@ -51,7 +68,7 @@ jobs:
           GH_TOKEN: ${{ secrets.ARCHIVE_REPO_TOKEN }}
           GH_REPO: ${{ vars.ARCHIVE_REPO }}
         if: |
-          inputs.nightly && env.GH_TOKEN != '' && env.GH_REPO != ''
+          inputs.channel == 'nightly' && env.GH_TOKEN != '' && env.GH_REPO != ''
         run: |
           gh release create \
             --notes-file ARCHIVE_NOTES \
@@ -60,7 +77,7 @@ jobs:
             artifact/*
 
       - name: Prune old nightly release
-        if: inputs.nightly && !vars.ARCHIVE_REPO
+        if: inputs.channel == 'nightly' && !vars.ARCHIVE_REPO
         env:
           GH_TOKEN: ${{ github.token }}
         run: |
@@ -68,14 +85,15 @@ jobs:
           git tag --delete "nightly" || true
           sleep 5  # Enough time to cover deletion race condition
 
-      - name: Publish release${{ inputs.nightly && ' (nightly)' || '' }}
+      - name: Publish release${{ inputs.channel == 'nightly' && ' (nightly)' || '' }}
         env:
           GH_TOKEN: ${{ github.token }}
-        if: (inputs.nightly && !vars.ARCHIVE_REPO) || !inputs.nightly
+        if: (inputs.channel == 'nightly' && !vars.ARCHIVE_REPO) || inputs.channel != 'nightly'
         run: |
           gh release create \
-            --notes-file ${{ inputs.nightly && 'PRE' || '' }}RELEASE_NOTES \
+            --notes-file ${{ inputs.channel == 'nightly' && 'NIGHTLY_NOTES' || 'RELEASE_NOTES' }} \
             --target ${{ inputs.target_commitish }} \
-            --title "yt-dlp ${{ inputs.nightly && 'nightly ' || '' }}${{ inputs.version }}" \
-            ${{ inputs.nightly && '--prerelease "nightly"' || inputs.version }} \
+            --title "yt-dlp ${{ inputs.channel == 'nightly' && 'nightly ' || '' }}${{ inputs.version }}" \
+            ${{ inputs.prerelease && '--prerelease' || '' }} \
+            ${{ inputs.channel == 'nightly' && '"nightly"' || inputs.version }} \
             artifact/*