]>
Commit | Line | Data |
---|---|---|
29cb20bd SS |
1 | name: Publish |
2 | on: | |
3 | workflow_call: | |
4 | inputs: | |
c4efa0ae | 5 | channel: |
6 | default: stable | |
7 | required: true | |
8 | type: string | |
29cb20bd SS |
9 | version: |
10 | required: true | |
11 | type: string | |
12 | target_commitish: | |
13 | required: true | |
14 | type: string | |
c4efa0ae | 15 | prerelease: |
16 | default: false | |
17 | required: true | |
18 | type: boolean | |
29cb20bd SS |
19 | secrets: |
20 | ARCHIVE_REPO_TOKEN: | |
21 | required: false | |
22 | ||
23 | permissions: | |
24 | contents: write | |
25 | ||
26 | jobs: | |
27 | publish: | |
28 | runs-on: ubuntu-latest | |
29 | ||
30 | steps: | |
31 | - uses: actions/checkout@v3 | |
32 | with: | |
33 | fetch-depth: 0 | |
34 | - uses: actions/download-artifact@v3 | |
35 | - uses: actions/setup-python@v4 | |
36 | with: | |
37 | python-version: "3.10" | |
38 | ||
39 | - name: Generate release notes | |
40 | run: | | |
c4efa0ae | 41 | printf '%s' \ |
42 | '[![Installation](https://img.shields.io/badge/-Which%20file%20should%20I%20download%3F-white.svg?style=for-the-badge)]' \ | |
43 | '(https://github.com/yt-dlp/yt-dlp#installation "Installation instructions") ' \ | |
44 | '[![Documentation](https://img.shields.io/badge/-Docs-brightgreen.svg?style=for-the-badge&logo=GitBook&labelColor=555555)]' \ | |
45 | '(https://github.com/yt-dlp/yt-dlp/tree/2023.03.04#readme "Documentation") ' \ | |
46 | '[![Donate](https://img.shields.io/badge/_-Donate-red.svg?logo=githubsponsors&labelColor=555555&style=for-the-badge)]' \ | |
47 | '(https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators "Donate") ' \ | |
48 | '[![Discord](https://img.shields.io/discord/807245652072857610?color=blue&labelColor=555555&label=&logo=discord&style=for-the-badge)]' \ | |
49 | '(https://discord.gg/H5MNcFW63r "Discord") ' \ | |
50 | ${{ inputs.channel != 'nightly' && '"[![Nightly](https://img.shields.io/badge/Get%20nightly%20builds-purple.svg?style=for-the-badge)]" \ | |
51 | "(https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latest \"Nightly builds\")"' || '' }} \ | |
52 | > ./RELEASE_NOTES | |
53 | printf '\n\n' >> ./RELEASE_NOTES | |
29cb20bd SS |
54 | cat >> ./RELEASE_NOTES << EOF |
55 | #### A description of the various files are in the [README](https://github.com/yt-dlp/yt-dlp#release-files) | |
56 | --- | |
57 | <details><summary><h3>Changelog</h3></summary> | |
58 | $(python ./devscripts/make_changelog.py -vv) | |
59 | </details> | |
60 | EOF | |
c4efa0ae | 61 | printf '%s\n\n' '**This is an automated nightly pre-release build**' >> ./NIGHTLY_NOTES |
62 | cat ./RELEASE_NOTES >> ./NIGHTLY_NOTES | |
63 | printf '%s\n\n' 'Generated from: https://github.com/${{ github.repository }}/commit/${{ inputs.target_commitish }}' >> ./ARCHIVE_NOTES | |
29cb20bd SS |
64 | cat ./RELEASE_NOTES >> ./ARCHIVE_NOTES |
65 | ||
66 | - name: Archive nightly release | |
67 | env: | |
68 | GH_TOKEN: ${{ secrets.ARCHIVE_REPO_TOKEN }} | |
69 | GH_REPO: ${{ vars.ARCHIVE_REPO }} | |
70 | if: | | |
c4efa0ae | 71 | inputs.channel == 'nightly' && env.GH_TOKEN != '' && env.GH_REPO != '' |
29cb20bd SS |
72 | run: | |
73 | gh release create \ | |
74 | --notes-file ARCHIVE_NOTES \ | |
08ff6d59 | 75 | --title "yt-dlp nightly ${{ inputs.version }}" \ |
29cb20bd SS |
76 | ${{ inputs.version }} \ |
77 | artifact/* | |
78 | ||
79 | - name: Prune old nightly release | |
c4efa0ae | 80 | if: inputs.channel == 'nightly' && !vars.ARCHIVE_REPO |
29cb20bd SS |
81 | env: |
82 | GH_TOKEN: ${{ github.token }} | |
83 | run: | | |
84 | gh release delete --yes --cleanup-tag "nightly" || true | |
85 | git tag --delete "nightly" || true | |
86 | sleep 5 # Enough time to cover deletion race condition | |
87 | ||
c4efa0ae | 88 | - name: Publish release${{ inputs.channel == 'nightly' && ' (nightly)' || '' }} |
29cb20bd SS |
89 | env: |
90 | GH_TOKEN: ${{ github.token }} | |
c4efa0ae | 91 | if: (inputs.channel == 'nightly' && !vars.ARCHIVE_REPO) || inputs.channel != 'nightly' |
29cb20bd SS |
92 | run: | |
93 | gh release create \ | |
c4efa0ae | 94 | --notes-file ${{ inputs.channel == 'nightly' && 'NIGHTLY_NOTES' || 'RELEASE_NOTES' }} \ |
29cb20bd | 95 | --target ${{ inputs.target_commitish }} \ |
c4efa0ae | 96 | --title "yt-dlp ${{ inputs.channel == 'nightly' && 'nightly ' || '' }}${{ inputs.version }}" \ |
97 | ${{ inputs.prerelease && '--prerelease' || '' }} \ | |
98 | ${{ inputs.channel == 'nightly' && '"nightly"' || inputs.version }} \ | |
29cb20bd | 99 | artifact/* |