]> jfr.im git - yt-dlp.git/blob - .github/workflows/publish.yml
[build] Automated builds and nightly releases (#6220)
[yt-dlp.git] / .github / workflows / publish.yml
1 name: Publish
2 on:
3 workflow_call:
4 inputs:
5 nightly:
6 default: false
7 required: false
8 type: boolean
9 version:
10 required: true
11 type: string
12 target_commitish:
13 required: true
14 type: string
15 secrets:
16 ARCHIVE_REPO_TOKEN:
17 required: false
18
19 permissions:
20 contents: write
21
22 jobs:
23 publish:
24 runs-on: ubuntu-latest
25
26 steps:
27 - uses: actions/checkout@v3
28 with:
29 fetch-depth: 0
30 - uses: actions/download-artifact@v3
31 - uses: actions/setup-python@v4
32 with:
33 python-version: "3.10"
34
35 - name: Generate release notes
36 run: |
37 cat >> ./RELEASE_NOTES << EOF
38 #### A description of the various files are in the [README](https://github.com/yt-dlp/yt-dlp#release-files)
39 ---
40 <details><summary><h3>Changelog</h3></summary>
41 $(python ./devscripts/make_changelog.py -vv)
42 </details>
43 EOF
44 echo "**This is an automated nightly pre-release build**" >> ./PRERELEASE_NOTES
45 cat ./RELEASE_NOTES >> ./PRERELEASE_NOTES
46 echo "Generated from: https://github.com/${{ github.repository }}/commit/${{ inputs.target_commitish }}" >> ./ARCHIVE_NOTES
47 cat ./RELEASE_NOTES >> ./ARCHIVE_NOTES
48
49 - name: Archive nightly release
50 env:
51 GH_TOKEN: ${{ secrets.ARCHIVE_REPO_TOKEN }}
52 GH_REPO: ${{ vars.ARCHIVE_REPO }}
53 if: |
54 inputs.nightly && env.GH_TOKEN != '' && env.GH_REPO != ''
55 run: |
56 gh release create \
57 --notes-file ARCHIVE_NOTES \
58 --title "Build ${{ inputs.version }}" \
59 ${{ inputs.version }} \
60 artifact/*
61
62 - name: Prune old nightly release
63 if: inputs.nightly
64 env:
65 GH_TOKEN: ${{ github.token }}
66 run: |
67 gh release delete --yes --cleanup-tag "nightly" || true
68 git tag --delete "nightly" || true
69 sleep 5 # Enough time to cover deletion race condition
70
71 - name: Publish release${{ inputs.nightly && ' (nightly)' || '' }}
72 env:
73 GH_TOKEN: ${{ github.token }}
74 run: |
75 gh release create \
76 --notes-file ${{ inputs.nightly && 'PRE' || '' }}RELEASE_NOTES \
77 --target ${{ inputs.target_commitish }} \
78 --title "yt-dlp ${{ inputs.nightly && 'nightly ' || '' }}${{ inputs.version }}" \
79 ${{ inputs.nightly && '--prerelease "nightly"' || inputs.version }} \
80 artifact/*