[build] Use workflow_dispatch for release

This commit is contained in:
pukkandan 2021-11-29 22:35:23 +05:30
parent 13ab5fa586
commit 75b725a7cc
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
5 changed files with 36 additions and 21 deletions

View file

@ -1,14 +1,11 @@
name: Build name: Build
on: workflow_dispatch
on:
push:
branches:
- release
jobs: jobs:
build_unix: build_unix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
version_suffix: ${{ steps.version_suffix.outputs.version_suffix }}
ytdlp_version: ${{ steps.bump_version.outputs.ytdlp_version }} ytdlp_version: ${{ steps.bump_version.outputs.ytdlp_version }}
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
sha256_bin: ${{ steps.sha256_bin.outputs.sha256_bin }} sha256_bin: ${{ steps.sha256_bin.outputs.sha256_bin }}
@ -26,21 +23,32 @@ jobs:
python-version: '3.8' python-version: '3.8'
- name: Install packages - name: Install packages
run: sudo apt-get -y install zip pandoc man run: sudo apt-get -y install zip pandoc man
- name: Set version suffix
id: version_suffix
env:
PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }}
if: "env.PUSH_VERSION_COMMIT == ''"
run: echo ::set-output name=version_suffix::$(date -u +"%H%M%S")
- name: Bump version - name: Bump version
id: bump_version id: bump_version
run: | run: |
python devscripts/update-version.py python devscripts/update-version.py ${{ steps.version_suffix.outputs.version_suffix }}
make issuetemplates make issuetemplates
- name: Update master - name: Push to release
id: push_update id: push_release
run: | run: |
git config --global user.email "${{ github.event.pusher.email }}" git config --global user.name github-actions
git config --global user.name "${{ github.event.pusher.name }}" git config --global user.email github-actions@example.com
git add -u git add -u
git commit -m "[version] update" -m ":ci skip all" git commit -m "[version] update" -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all"
git pull --rebase origin ${{ github.event.repository.master_branch }} git push origin --force ${{ github.event.ref }}:release
git push origin ${{ github.event.ref }}:${{ github.event.repository.master_branch }}
echo ::set-output name=head_sha::$(git rev-parse HEAD) echo ::set-output name=head_sha::$(git rev-parse HEAD)
- name: Update master
id: push_master
env:
PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }}
if: "env.PUSH_VERSION_COMMIT != ''"
run: git push origin ${{ github.event.ref }}
- name: Get Changelog - name: Get Changelog
id: get_changelog id: get_changelog
run: | run: |
@ -231,7 +239,9 @@ jobs:
pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-4.5.1-py3-none-any.whl" mutagen pycryptodomex websockets pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-4.5.1-py3-none-any.whl" mutagen pycryptodomex websockets
- name: Bump version - name: Bump version
id: bump_version id: bump_version
run: python devscripts/update-version.py env:
version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
run: python devscripts/update-version.py ${{ env.version_suffix }}
- name: Build lazy extractors - name: Build lazy extractors
id: lazy_extractors id: lazy_extractors
run: python devscripts/make_lazy_extractors.py run: python devscripts/make_lazy_extractors.py
@ -318,7 +328,9 @@ jobs:
pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-4.5.1-py3-none-any.whl" mutagen pycryptodomex websockets pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-4.5.1-py3-none-any.whl" mutagen pycryptodomex websockets
- name: Bump version - name: Bump version
id: bump_version id: bump_version
run: python devscripts/update-version.py env:
version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
run: python devscripts/update-version.py ${{ env.version_suffix }}
- name: Build lazy extractors - name: Build lazy extractors
id: lazy_extractors id: lazy_extractors
run: python devscripts/make_lazy_extractors.py run: python devscripts/make_lazy_extractors.py

View file

@ -7,10 +7,8 @@
* Update Changelog.md and CONTRIBUTORS * Update Changelog.md and CONTRIBUTORS
* Change "Merged with ytdl" version in Readme.md if needed * Change "Merged with ytdl" version in Readme.md if needed
* Add new/fixed extractors in "new features" section of Readme.md * Add new/fixed extractors in "new features" section of Readme.md
* Commit as `Release <version>` * Commit as `Release <version>` and push to master
* Push to origin/release using `git push origin master:release` * Dispatch the workflow https://github.com/yt-dlp/yt-dlp/actions/workflows/build.yml on master
build task will now run
--> -->

View file

@ -288,7 +288,7 @@ Then simply run `make`. You can also run `make yt-dlp` instead to compile only t
**Note**: In either platform, `devscripts/update-version.py` can be used to automatically update the version number **Note**: In either platform, `devscripts/update-version.py` can be used to automatically update the version number
You can also fork the project on github and push it to a release branch in your fork for the [build workflow](https://github.com/yt-dlp/yt-dlp/blob/master/.github/workflows/build.yml) to automatically make a release for you You can also fork the project on github and run your fork's [build workflow](.github/workflows/build.yml) to automatically build a release
# USAGE AND OPTIONS # USAGE AND OPTIONS

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from datetime import datetime from datetime import datetime
import sys
import subprocess import subprocess
@ -13,7 +14,10 @@ old_ver = '.'.join(old_version_list[:3])
old_rev = old_version_list[3] if len(old_version_list) > 3 else '' old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
ver = datetime.utcnow().strftime("%Y.%m.%d") ver = datetime.utcnow().strftime("%Y.%m.%d")
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
rev = (sys.argv[1:] or [''])[0] # Use first argument, if present as revision number
if not rev:
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
VERSION = '.'.join((ver, rev)) if rev else ver VERSION = '.'.join((ver, rev)) if rev else ver

View file

@ -102,6 +102,7 @@ def run_update(ydl):
return tuple(map(int, version_str.split('.'))) return tuple(map(int, version_str.split('.')))
version_id = version_info['tag_name'] version_id = version_info['tag_name']
ydl.to_screen(f'Latest version: {version_id}, Current version: {__version__}')
if version_tuple(__version__) >= version_tuple(version_id): if version_tuple(__version__) >= version_tuple(version_id):
ydl.to_screen(f'yt-dlp is up to date ({__version__})') ydl.to_screen(f'yt-dlp is up to date ({__version__})')
return return