]> jfr.im git - yt-dlp.git/blob - .github/workflows/release.yml
[build] Sign SHA files and release public key
[yt-dlp.git] / .github / workflows / release.yml
1 name: Release
2 on: workflow_dispatch
3 permissions:
4 contents: read
5
6 jobs:
7 prepare:
8 permissions:
9 contents: write
10 runs-on: ubuntu-latest
11 outputs:
12 version: ${{ steps.update_version.outputs.version }}
13 head_sha: ${{ steps.push_release.outputs.head_sha }}
14
15 steps:
16 - uses: actions/checkout@v3
17 with:
18 fetch-depth: 0
19
20 - uses: actions/setup-python@v4
21 with:
22 python-version: "3.10"
23
24 - name: Update version
25 id: update_version
26 run: |
27 python devscripts/update-version.py ${{ vars.PUSH_VERSION_COMMIT == '' && '"$(date -u +"%H%M%S")"' || '' }} | \
28 grep -Po "version=\d+\.\d+\.\d+(\.\d+)?" >> "$GITHUB_OUTPUT"
29
30 - name: Update documentation
31 run: |
32 make doc
33 sed '/### /Q' Changelog.md >> ./CHANGELOG
34 echo '### ${{ steps.update_version.outputs.version }}' >> ./CHANGELOG
35 python ./devscripts/make_changelog.py -vv -c >> ./CHANGELOG
36 echo >> ./CHANGELOG
37 grep -Poz '(?s)### \d+\.\d+\.\d+.+' 'Changelog.md' | head -n -1 >> ./CHANGELOG
38 cat ./CHANGELOG > Changelog.md
39
40 - name: Push to release
41 id: push_release
42 run: |
43 git config --global user.name github-actions
44 git config --global user.email github-actions@example.com
45 git add -u
46 git commit -m "Release ${{ steps.update_version.outputs.version }}" \
47 -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all :ci run dl"
48 git push origin --force ${{ github.event.ref }}:release
49 echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
50
51 - name: Update master
52 if: vars.PUSH_VERSION_COMMIT != ''
53 run: git push origin ${{ github.event.ref }}
54
55 publish_pypi_homebrew:
56 needs: prepare
57 runs-on: ubuntu-latest
58
59 steps:
60 - uses: actions/checkout@v3
61 - uses: actions/setup-python@v4
62 with:
63 python-version: "3.10"
64
65 - name: Install Requirements
66 run: |
67 python -m pip install -U pip setuptools wheel twine
68 python -m pip install -U -r requirements.txt
69
70 - name: Prepare
71 run: |
72 python devscripts/update-version.py ${{ needs.prepare.outputs.version }}
73 python devscripts/make_lazy_extractors.py
74
75 - name: Build and publish on PyPI
76 env:
77 TWINE_USERNAME: __token__
78 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
79 if: env.TWINE_PASSWORD != ''
80 run: |
81 rm -rf dist/*
82 python devscripts/set-variant.py pip -M "You installed yt-dlp with pip or using the wheel from PyPi; Use that to update"
83 python setup.py sdist bdist_wheel
84 twine upload dist/*
85
86 - name: Checkout Homebrew repository
87 env:
88 BREW_TOKEN: ${{ secrets.BREW_TOKEN }}
89 PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
90 if: env.BREW_TOKEN != '' && env.PYPI_TOKEN != ''
91 uses: actions/checkout@v3
92 with:
93 repository: yt-dlp/homebrew-taps
94 path: taps
95 ssh-key: ${{ secrets.BREW_TOKEN }}
96
97 - name: Update Homebrew Formulae
98 env:
99 BREW_TOKEN: ${{ secrets.BREW_TOKEN }}
100 PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
101 if: env.BREW_TOKEN != '' && env.PYPI_TOKEN != ''
102 run: |
103 python devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ needs.prepare.outputs.version }}"
104 git -C taps/ config user.name github-actions
105 git -C taps/ config user.email github-actions@example.com
106 git -C taps/ commit -am 'yt-dlp: ${{ needs.prepare.outputs.version }}'
107 git -C taps/ push
108
109 build:
110 needs: prepare
111 uses: ./.github/workflows/build.yml
112 with:
113 version: ${{ needs.prepare.outputs.version }}
114 permissions:
115 contents: read
116 packages: write # For package cache
117 secrets:
118 GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
119
120 publish:
121 needs: [prepare, build]
122 uses: ./.github/workflows/publish.yml
123 permissions:
124 contents: write
125 with:
126 version: ${{ needs.prepare.outputs.version }}
127 target_commitish: ${{ needs.prepare.outputs.head_sha }}