]>
Commit | Line | Data |
---|---|---|
29cb20bd | 1 | name: Release |
c4efa0ae | 2 | on: |
3 | workflow_dispatch: | |
4 | inputs: | |
5 | version: | |
6 | description: Version tag (YYYY.MM.DD[.REV]) | |
7 | required: false | |
8 | default: '' | |
9 | type: string | |
10 | channel: | |
11 | description: Update channel (stable/nightly/...) | |
12 | required: false | |
13 | default: '' | |
14 | type: string | |
15 | prerelease: | |
16 | description: Pre-release | |
17 | default: false | |
18 | type: boolean | |
19 | ||
29cb20bd SS |
20 | permissions: |
21 | contents: read | |
22 | ||
23 | jobs: | |
24 | prepare: | |
25 | permissions: | |
26 | contents: write | |
27 | runs-on: ubuntu-latest | |
28 | outputs: | |
c4efa0ae | 29 | channel: ${{ steps.set_channel.outputs.channel }} |
29cb20bd | 30 | version: ${{ steps.update_version.outputs.version }} |
c4efa0ae | 31 | head_sha: ${{ steps.get_target.outputs.head_sha }} |
29cb20bd SS |
32 | |
33 | steps: | |
34 | - uses: actions/checkout@v3 | |
35 | with: | |
36 | fetch-depth: 0 | |
37 | ||
38 | - uses: actions/setup-python@v4 | |
39 | with: | |
40 | python-version: "3.10" | |
41 | ||
c4efa0ae | 42 | - name: Set channel |
43 | id: set_channel | |
44 | run: | | |
45 | CHANNEL="${{ github.repository == 'yt-dlp/yt-dlp' && 'stable' || github.repository }}" | |
46 | echo "channel=${{ inputs.channel || '$CHANNEL' }}" > "$GITHUB_OUTPUT" | |
47 | ||
29cb20bd SS |
48 | - name: Update version |
49 | id: update_version | |
50 | run: | | |
c4efa0ae | 51 | REVISION="${{ vars.PUSH_VERSION_COMMIT == '' && '$(date -u +"%H%M%S")' || '' }}" |
52 | REVISION="${{ inputs.prerelease && '$(date -u +"%H%M%S")' || '$REVISION' }}" | |
53 | python devscripts/update-version.py ${{ inputs.version || '$REVISION' }} | \ | |
29cb20bd SS |
54 | grep -Po "version=\d+\.\d+\.\d+(\.\d+)?" >> "$GITHUB_OUTPUT" |
55 | ||
56 | - name: Update documentation | |
57 | run: | | |
58 | make doc | |
59 | sed '/### /Q' Changelog.md >> ./CHANGELOG | |
60 | echo '### ${{ steps.update_version.outputs.version }}' >> ./CHANGELOG | |
61 | python ./devscripts/make_changelog.py -vv -c >> ./CHANGELOG | |
62 | echo >> ./CHANGELOG | |
63 | grep -Poz '(?s)### \d+\.\d+\.\d+.+' 'Changelog.md' | head -n -1 >> ./CHANGELOG | |
64 | cat ./CHANGELOG > Changelog.md | |
65 | ||
66 | - name: Push to release | |
67 | id: push_release | |
c4efa0ae | 68 | if: ${{ !inputs.prerelease }} |
29cb20bd SS |
69 | run: | |
70 | git config --global user.name github-actions | |
71 | git config --global user.email github-actions@example.com | |
72 | git add -u | |
73 | git commit -m "Release ${{ steps.update_version.outputs.version }}" \ | |
74 | -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all :ci run dl" | |
75 | git push origin --force ${{ github.event.ref }}:release | |
c4efa0ae | 76 | |
77 | - name: Get target commitish | |
78 | id: get_target | |
79 | run: | | |
29cb20bd SS |
80 | echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
81 | ||
82 | - name: Update master | |
c4efa0ae | 83 | if: vars.PUSH_VERSION_COMMIT != '' && !inputs.prerelease |
29cb20bd SS |
84 | run: git push origin ${{ github.event.ref }} |
85 | ||
c4efa0ae | 86 | build: |
29cb20bd | 87 | needs: prepare |
c4efa0ae | 88 | uses: ./.github/workflows/build.yml |
89 | with: | |
90 | version: ${{ needs.prepare.outputs.version }} | |
91 | channel: ${{ needs.prepare.outputs.channel }} | |
92 | permissions: | |
93 | contents: read | |
94 | packages: write # For package cache | |
95 | secrets: | |
96 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
97 | ||
98 | publish_pypi_homebrew: | |
99 | needs: [prepare, build] | |
29cb20bd SS |
100 | runs-on: ubuntu-latest |
101 | ||
102 | steps: | |
103 | - uses: actions/checkout@v3 | |
104 | - uses: actions/setup-python@v4 | |
105 | with: | |
106 | python-version: "3.10" | |
107 | ||
108 | - name: Install Requirements | |
109 | run: | | |
55676fe4 | 110 | sudo apt-get -y install pandoc man |
29cb20bd SS |
111 | python -m pip install -U pip setuptools wheel twine |
112 | python -m pip install -U -r requirements.txt | |
113 | ||
114 | - name: Prepare | |
115 | run: | | |
116 | python devscripts/update-version.py ${{ needs.prepare.outputs.version }} | |
117 | python devscripts/make_lazy_extractors.py | |
118 | ||
119 | - name: Build and publish on PyPI | |
120 | env: | |
121 | TWINE_USERNAME: __token__ | |
122 | TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
c4efa0ae | 123 | if: env.TWINE_PASSWORD != '' && !inputs.prerelease |
29cb20bd SS |
124 | run: | |
125 | rm -rf dist/* | |
55676fe4 | 126 | make pypi-files |
29cb20bd SS |
127 | python devscripts/set-variant.py pip -M "You installed yt-dlp with pip or using the wheel from PyPi; Use that to update" |
128 | python setup.py sdist bdist_wheel | |
129 | twine upload dist/* | |
130 | ||
131 | - name: Checkout Homebrew repository | |
132 | env: | |
133 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
134 | PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
c4efa0ae | 135 | if: env.BREW_TOKEN != '' && env.PYPI_TOKEN != '' && !inputs.prerelease |
29cb20bd SS |
136 | uses: actions/checkout@v3 |
137 | with: | |
138 | repository: yt-dlp/homebrew-taps | |
139 | path: taps | |
140 | ssh-key: ${{ secrets.BREW_TOKEN }} | |
141 | ||
142 | - name: Update Homebrew Formulae | |
143 | env: | |
144 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
145 | PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
c4efa0ae | 146 | if: env.BREW_TOKEN != '' && env.PYPI_TOKEN != '' && !inputs.prerelease |
29cb20bd SS |
147 | run: | |
148 | python devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ needs.prepare.outputs.version }}" | |
149 | git -C taps/ config user.name github-actions | |
150 | git -C taps/ config user.email github-actions@example.com | |
151 | git -C taps/ commit -am 'yt-dlp: ${{ needs.prepare.outputs.version }}' | |
152 | git -C taps/ push | |
153 | ||
29cb20bd SS |
154 | publish: |
155 | needs: [prepare, build] | |
156 | uses: ./.github/workflows/publish.yml | |
157 | permissions: | |
158 | contents: write | |
159 | with: | |
c4efa0ae | 160 | channel: ${{ needs.prepare.outputs.channel }} |
161 | prerelease: ${{ inputs.prerelease }} | |
29cb20bd SS |
162 | version: ${{ needs.prepare.outputs.version }} |
163 | target_commitish: ${{ needs.prepare.outputs.head_sha }} |