]>
Commit | Line | Data |
---|---|---|
29cb20bd SS |
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: | | |
55676fe4 | 67 | sudo apt-get -y install pandoc man |
29cb20bd SS |
68 | python -m pip install -U pip setuptools wheel twine |
69 | python -m pip install -U -r requirements.txt | |
70 | ||
71 | - name: Prepare | |
72 | run: | | |
73 | python devscripts/update-version.py ${{ needs.prepare.outputs.version }} | |
74 | python devscripts/make_lazy_extractors.py | |
75 | ||
76 | - name: Build and publish on PyPI | |
77 | env: | |
78 | TWINE_USERNAME: __token__ | |
79 | TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
80 | if: env.TWINE_PASSWORD != '' | |
81 | run: | | |
82 | rm -rf dist/* | |
55676fe4 | 83 | make pypi-files |
29cb20bd SS |
84 | python devscripts/set-variant.py pip -M "You installed yt-dlp with pip or using the wheel from PyPi; Use that to update" |
85 | python setup.py sdist bdist_wheel | |
86 | twine upload dist/* | |
87 | ||
88 | - name: Checkout Homebrew repository | |
89 | env: | |
90 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
91 | PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
92 | if: env.BREW_TOKEN != '' && env.PYPI_TOKEN != '' | |
93 | uses: actions/checkout@v3 | |
94 | with: | |
95 | repository: yt-dlp/homebrew-taps | |
96 | path: taps | |
97 | ssh-key: ${{ secrets.BREW_TOKEN }} | |
98 | ||
99 | - name: Update Homebrew Formulae | |
100 | env: | |
101 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
102 | PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
103 | if: env.BREW_TOKEN != '' && env.PYPI_TOKEN != '' | |
104 | run: | | |
105 | python devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ needs.prepare.outputs.version }}" | |
106 | git -C taps/ config user.name github-actions | |
107 | git -C taps/ config user.email github-actions@example.com | |
108 | git -C taps/ commit -am 'yt-dlp: ${{ needs.prepare.outputs.version }}' | |
109 | git -C taps/ push | |
110 | ||
111 | build: | |
112 | needs: prepare | |
113 | uses: ./.github/workflows/build.yml | |
114 | with: | |
115 | version: ${{ needs.prepare.outputs.version }} | |
116 | permissions: | |
117 | contents: read | |
118 | packages: write # For package cache | |
12647e03 SS |
119 | secrets: |
120 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
29cb20bd SS |
121 | |
122 | publish: | |
123 | needs: [prepare, build] | |
124 | uses: ./.github/workflows/publish.yml | |
125 | permissions: | |
126 | contents: write | |
127 | with: | |
128 | version: ${{ needs.prepare.outputs.version }} | |
129 | target_commitish: ${{ needs.prepare.outputs.head_sha }} |