diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f110559fb..7a3c5890e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,12 +6,19 @@ on: build-commit: type: string required: true + push-version-commit: + type: boolean + default: true workflow_dispatch: inputs: build-commit: description: 'SHA of commit being built' type: string required: false + push-version-commit: + description: 'Update master if set' + type: boolean + default: true jobs: build_unix: @@ -26,9 +33,10 @@ jobs: sha512_tar: ${{ steps.sha512_tar.outputs.sha512_tar }} steps: - - uses: actions/checkout@v3 + - name: Check out + uses: actions/checkout@v3 with: - ref: HEAD + ref: ${{ github.event.ref }} fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v4 @@ -44,12 +52,22 @@ jobs: 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+]}" + echo "Version = $ytdl_version${sha+ [}${sha}${sha+]}" make issuetemplates - name: Push to release id: push_release - run: echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - - name: Get Changelog + run: | + git config --global user.name github-actions + git config --global user.email github-actions@example.com + git add -u + git commit -m "Release (nightly) ${{ steps.update_version.outputs.version }}" \ + -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all" + git push origin --force ${{ github.event.ref }}:release + echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Update master + if: ${{ inputs.push-version-commit }} + run: git push origin ${{ github.event.ref }} + - name: Get Changelog id: get_changelog run: | changelog=$(cat Changelog.md | grep -oPz '(?s)(?<=### ${{ steps.bump_version.outputs.ytdl_version }}\n{2}).+?(?=\n{2,3}###)') || true @@ -115,6 +133,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.event.ref }} # reason to choose 3.4: https://media.discordapp.net/attachments/807245652072857613/942409077701619742/unknown.png - name: Set up Python 3.4 uses: actions/setup-python@v4 @@ -127,15 +147,6 @@ jobs: # https://pip.pypa.io/en/stable/news/#v19-2 # https://wheel.readthedocs.io/en/stable/news.html run: python -m pip install --upgrade "pip<19.2" "setuptools<44" "wheel<0.34.0" py2exe==0.9.2.2 - - name: Bump version - id: bump_version - shell: bash - run: | - 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 # run: python -m PyInstaller --onefile --console --distpath dist/ -n youtube-dl youtube_dl\__main__.py - name: Cache PyCrypto