mirror of
https://github.com/ytdl-org/ytdl-nightly.git
synced 2025-02-26 16:18:16 +01:00
[workflow] Link Rebase-on-upstream to Build
* make Build callable but not scheduled * make Build receive commit SHA from caller * make Rebase pass commit SHA to Build * Don't set GH output from update-version.py * No rebase is still success * Allow scheduled Rebase to invoke Build
This commit is contained in:
parent
ebb61a70bd
commit
9235c3f7e8
56
.github/workflows/build.yml
vendored
56
.github/workflows/build.yml
vendored
@ -1,9 +1,17 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
build-commit:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
inputs:
|
||||||
- cron: "0 2 * * *"
|
build-commit:
|
||||||
|
description: 'SHA of commit being built'
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_unix:
|
build_unix:
|
||||||
@ -18,26 +26,28 @@ jobs:
|
|||||||
sha512_tar: ${{ steps.sha512_tar.outputs.sha512_tar }}
|
sha512_tar: ${{ steps.sha512_tar.outputs.sha512_tar }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.8'
|
python-version: '3.9'
|
||||||
- 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
|
|
||||||
run: echo ::set-output name=version_suffix::$( printf '114514\n40298\n43044\n810\n1919\n19419\n334' | sort -R | head -n1 )
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
run: |
|
run: |
|
||||||
python devscripts/update-version.py ${{ steps.version_suffix.outputs.version_suffix }}
|
ytdl_version=$(python devscripts/update-version.py)
|
||||||
|
echo "ytdl_version=$ytdl_version" >> "$GITHUB_OUTPUT"
|
||||||
|
sha=${{ inputs.build-commit }}
|
||||||
|
sed -i -rn -e '/^ *RELEASE_GIT_HEAD *=/z;$s/$/&'"\nRELEASE_GIT_HEAD = '${sha}'/;p" youtube_dl/version.py
|
||||||
|
x=${sha#?????????}; sha=${sha%$x}
|
||||||
|
echo "Version = $ytdl_version${sha+[ }${sha}${sha+]}"
|
||||||
make issuetemplates
|
make issuetemplates
|
||||||
- name: Push to release
|
- name: Push to release
|
||||||
id: push_release
|
id: push_release
|
||||||
run: echo ::set-output name=head_sha::$(git rev-parse HEAD)
|
run: echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
|
||||||
- name: Get Changelog
|
- name: Get Changelog
|
||||||
id: get_changelog
|
id: get_changelog
|
||||||
run: |
|
run: |
|
||||||
@ -50,16 +60,16 @@ jobs:
|
|||||||
run: make all tar
|
run: make all tar
|
||||||
- name: Get SHA2-256SUMS for youtube-dl
|
- name: Get SHA2-256SUMS for youtube-dl
|
||||||
id: sha256_bin
|
id: sha256_bin
|
||||||
run: echo "::set-output name=sha256_bin::$(sha256sum youtube-dl | awk '{print $1}')"
|
run: echo "sha256_bin=$(sha256sum youtube-dl | awk '{print $1}')" >> "$GITHUB_OUTPUT"
|
||||||
- name: Get SHA2-256SUMS for youtube-dl.tar.gz
|
- name: Get SHA2-256SUMS for youtube-dl.tar.gz
|
||||||
id: sha256_tar
|
id: sha256_tar
|
||||||
run: echo "::set-output name=sha256_tar::$(sha256sum youtube-dl.tar.gz | awk '{print $1}')"
|
run: echo "sha256_tar=$(sha256sum youtube-dl.tar.gz | awk '{print $1}')" >> "$GITHUB_OUTPUT"
|
||||||
- name: Get SHA2-512SUMS for youtube-dl
|
- name: Get SHA2-512SUMS for youtube-dl
|
||||||
id: sha512_bin
|
id: sha512_bin
|
||||||
run: echo "::set-output name=sha512_bin::$(sha512sum youtube-dl | awk '{print $1}')"
|
run: echo "sha512_bin=$(sha512sum youtube-dl | awk '{print $1}')" >> "$GITHUB_OUTPUT"
|
||||||
- name: Get SHA2-512SUMS for youtube-dl.tar.gz
|
- name: Get SHA2-512SUMS for youtube-dl.tar.gz
|
||||||
id: sha512_tar
|
id: sha512_tar
|
||||||
run: echo "::set-output name=sha512_tar::$(sha512sum youtube-dl.tar.gz | awk '{print $1}')"
|
run: echo "sha512_tar=$(sha512sum youtube-dl.tar.gz | awk '{print $1}')" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
@ -101,10 +111,10 @@ jobs:
|
|||||||
sha512_win: ${{ steps.sha512_win.outputs.sha512_win }}
|
sha512_win: ${{ steps.sha512_win.outputs.sha512_win }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
# reason to choose 3.4: https://media.discordapp.net/attachments/807245652072857613/942409077701619742/unknown.png
|
# reason to choose 3.4: https://media.discordapp.net/attachments/807245652072857613/942409077701619742/unknown.png
|
||||||
- name: Set up Python 3.4
|
- name: Set up Python 3.4
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.4'
|
python-version: '3.4'
|
||||||
architecture: 'x86'
|
architecture: 'x86'
|
||||||
@ -116,9 +126,13 @@ jobs:
|
|||||||
run: python -m pip install --upgrade "pip<19.2" "setuptools<44" "wheel<0.34.0" py2exe==0.9.2.2
|
run: python -m pip install --upgrade "pip<19.2" "setuptools<44" "wheel<0.34.0" py2exe==0.9.2.2
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
env:
|
shell: bash
|
||||||
version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
|
run: |
|
||||||
run: python devscripts/update-version.py ${{ env.version_suffix }}
|
ytdl_version=$(python devscripts/update-version.py)
|
||||||
|
sha=${{ inputs.build-commit }}
|
||||||
|
sed -i -rn -e '/^ *RELEASE_GIT_HEAD *=/z;$s/$/&'"\nRELEASE_GIT_HEAD = '${sha}'/;p" youtube_dl/version.py
|
||||||
|
x=${sha#?????????}; sha=${sha%$x}
|
||||||
|
echo "Version = $ytdl_version${sha+[ }${sha}${sha+]}"
|
||||||
# - name: Run PyInstaller Script
|
# - name: Run PyInstaller Script
|
||||||
# run: python -m PyInstaller --onefile --console --distpath dist/ -n youtube-dl youtube_dl\__main__.py
|
# run: python -m PyInstaller --onefile --console --distpath dist/ -n youtube-dl youtube_dl\__main__.py
|
||||||
- name: Build EXE file
|
- name: Build EXE file
|
||||||
@ -135,10 +149,10 @@ jobs:
|
|||||||
asset_content_type: application/vnd.microsoft.portable-executable
|
asset_content_type: application/vnd.microsoft.portable-executable
|
||||||
- name: Get SHA2-256SUMS for youtube-dl.exe
|
- name: Get SHA2-256SUMS for youtube-dl.exe
|
||||||
id: sha256_win
|
id: sha256_win
|
||||||
run: echo "::set-output name=sha256_win::$((Get-FileHash youtube-dl.exe -Algorithm SHA256).Hash.ToLower())"
|
run: echo "sha256_win=$((Get-FileHash youtube-dl.exe -Algorithm SHA256).Hash.ToLower())" >> "$env:GITHUB_OUTPUT"
|
||||||
- name: Get SHA2-512SUMS for youtube-dl.exe
|
- name: Get SHA2-512SUMS for youtube-dl.exe
|
||||||
id: sha512_win
|
id: sha512_win
|
||||||
run: echo "::set-output name=sha512_win::$((Get-FileHash youtube-dl.exe -Algorithm SHA512).Hash.ToLower())"
|
run: echo "sha512_win=$((Get-FileHash youtube-dl.exe -Algorithm SHA512).Hash.ToLower())" >> "$env:GITHUB_OUTPUT"
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
27
.github/workflows/rebase-on-upstream.yml
vendored
27
.github/workflows/rebase-on-upstream.yml
vendored
@ -2,18 +2,39 @@ name: Rebase on Upstream
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: '53 0 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rebase:
|
rebase:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
build-commit: ${{ steps.relocate.outputs.build-commit }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- name: Checkout
|
||||||
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
- uses: ytdl-org/ytdl-patched-rebase-upstream-action@master
|
- name: Locate
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "HEAD_NOW=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
|
||||||
|
- name: Rebase
|
||||||
|
uses: ytdl-org/ytdl-patched-rebase-upstream-action@master
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
upstream: ytdl-org/youtube-dl
|
upstream: ytdl-org/youtube-dl
|
||||||
|
- name: Relocate
|
||||||
|
id: relocate
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
NEW_HEAD=$(git rev-parse HEAD)
|
||||||
|
[ "${{ env.HEAD_NOW }}" = "$NEW_HEAD" ] || echo "build-commit=$NEW_HEAD" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: rebase
|
||||||
|
if: ${{ needs.rebase.outputs.build-commit }}
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
with:
|
||||||
|
build-commit: ${{ needs.rebase.outputs.build-commit }}
|
||||||
|
@ -22,6 +22,7 @@ if not rev:
|
|||||||
VERSION = '.'.join((ver, rev)) if rev else ver
|
VERSION = '.'.join((ver, rev)) if rev else ver
|
||||||
|
|
||||||
VERSION_FILE = '''# Autogenerated by devscripts/update-version.py
|
VERSION_FILE = '''# Autogenerated by devscripts/update-version.py
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__version__ = {!r}
|
__version__ = {!r}
|
||||||
'''.format(VERSION)
|
'''.format(VERSION)
|
||||||
@ -29,5 +30,4 @@ __version__ = {!r}
|
|||||||
with open('youtube_dl/version.py', 'wt') as f:
|
with open('youtube_dl/version.py', 'wt') as f:
|
||||||
f.write(VERSION_FILE)
|
f.write(VERSION_FILE)
|
||||||
|
|
||||||
print('::set-output name=ytdl_version::' + VERSION)
|
print(VERSION)
|
||||||
print('\nVersion = %s' % VERSION)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user