~hackershohag/yt-dlp-ut/master

« back to all changes in this revision

Viewing changes to .github/workflows/build.yml

  • Committer: GitHub Actions
  • Author(s): Lesmiscore
  • Date: 2023-03-15 00:54:14 UTC
  • Revision ID: git-v1:96c43d89b4a8ec1e555efff6dd92dc29c7c8e433
Tags: 2023.03.15.40298, 2023.03.16.1919, 2023.03.17.114514, 2023.03.18.334, 2023.03.19.43044, 2023.03.20.43044, 2023.03.21.810, 2023.03.22.40298, 2023.03.23.114514, 2023.03.24.114514, 2023.03.25.810, 2023.03.26.43044, 2023.03.27.19419, 2023.03.28.43044, 2023.03.29.1919, 2023.03.30.19419, 2023.03.31.334, 2023.04.01.1919, 2023.04.02.810
Automated Daily Builds

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
name: Build
 
2
 
 
3
on:
 
4
  workflow_dispatch:
 
5
  schedule:
 
6
    - cron: "0 2 * * *"
 
7
 
 
8
jobs:
 
9
  build_unix:
 
10
    runs-on: ubuntu-latest
 
11
    outputs:
 
12
      version_suffix: ${{ steps.version_suffix.outputs.version_suffix }}
 
13
      ytdl_version: ${{ steps.bump_version.outputs.ytdl_version }}
 
14
      upload_url: ${{ steps.create_release.outputs.upload_url }}
 
15
      sha256_bin: ${{ steps.sha256_bin.outputs.sha256_bin }}
 
16
      sha512_bin: ${{ steps.sha512_bin.outputs.sha512_bin }}
 
17
      sha256_tar: ${{ steps.sha256_tar.outputs.sha256_tar }}
 
18
      sha512_tar: ${{ steps.sha512_tar.outputs.sha512_tar }}
 
19
 
 
20
    steps:
 
21
    - uses: actions/checkout@v2
 
22
      with:
 
23
        fetch-depth: 0
 
24
    - name: Set up Python
 
25
      uses: actions/setup-python@v2
 
26
      with:
 
27
          python-version: '3.8'
 
28
    - name: Install packages
 
29
      run: sudo apt-get -y install zip pandoc man
 
30
    - name: Set version suffix
 
31
      id: version_suffix
 
32
      run: echo ::set-output name=version_suffix::$( printf '114514\n40298\n43044\n810\n1919\n19419\n334' | sort -R | head -n1 )
 
33
    - name: Bump version
 
34
      id: bump_version
 
35
      run: |
 
36
        python devscripts/update-version.py ${{ steps.version_suffix.outputs.version_suffix }}
 
37
        make issuetemplates
 
38
    - name: Push to release
 
39
      id: push_release
 
40
      run: echo ::set-output name=head_sha::$(git rev-parse HEAD)
 
41
    - name: Get Changelog
 
42
      id: get_changelog
 
43
      run: |
 
44
        changelog=$(cat Changelog.md | grep -oPz '(?s)(?<=### ${{ steps.bump_version.outputs.ytdl_version }}\n{2}).+?(?=\n{2,3}###)') || true
 
45
        echo "changelog<<EOF" >> $GITHUB_ENV
 
46
        echo "$changelog" >> $GITHUB_ENV
 
47
        echo "EOF" >> $GITHUB_ENV
 
48
 
 
49
    - name: Run Make
 
50
      run: make all tar
 
51
    - name: Get SHA2-256SUMS for youtube-dl
 
52
      id: sha256_bin
 
53
      run: echo "::set-output name=sha256_bin::$(sha256sum youtube-dl | awk '{print $1}')"
 
54
    - name: Get SHA2-256SUMS for youtube-dl.tar.gz
 
55
      id: sha256_tar
 
56
      run: echo "::set-output name=sha256_tar::$(sha256sum youtube-dl.tar.gz | awk '{print $1}')"
 
57
    - name: Get SHA2-512SUMS for youtube-dl
 
58
      id: sha512_bin
 
59
      run: echo "::set-output name=sha512_bin::$(sha512sum youtube-dl | awk '{print $1}')"
 
60
    - name: Get SHA2-512SUMS for youtube-dl.tar.gz
 
61
      id: sha512_tar
 
62
      run: echo "::set-output name=sha512_tar::$(sha512sum youtube-dl.tar.gz | awk '{print $1}')"
 
63
 
 
64
    - name: Create Release
 
65
      id: create_release
 
66
      uses: actions/create-release@v1
 
67
      env:
 
68
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
69
      with:
 
70
        tag_name: ${{ steps.bump_version.outputs.ytdl_version }}
 
71
        release_name: youtube-dl ${{ steps.bump_version.outputs.ytdl_version }}
 
72
        commitish: ${{ steps.push_release.outputs.head_sha }}
 
73
        body: This is a daily build of youtube-dl.
 
74
        draft: false
 
75
        prerelease: false
 
76
    - name: Upload youtube-dl Unix binary
 
77
      id: upload-release-asset
 
78
      uses: actions/upload-release-asset@v1
 
79
      env:
 
80
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
81
      with:
 
82
        upload_url: ${{ steps.create_release.outputs.upload_url }}
 
83
        asset_path: ./youtube-dl
 
84
        asset_name: youtube-dl
 
85
        asset_content_type: application/octet-stream
 
86
    - name: Upload Source tar
 
87
      uses: actions/upload-release-asset@v1
 
88
      env:
 
89
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
90
      with:
 
91
        upload_url: ${{ steps.create_release.outputs.upload_url }}
 
92
        asset_path: ./youtube-dl.tar.gz
 
93
        asset_name: youtube-dl-${{ steps.bump_version.outputs.ytdl_version }}.tar.gz
 
94
        asset_content_type: application/gzip
 
95
 
 
96
  build_windows:
 
97
    runs-on: windows-2022
 
98
    needs: build_unix
 
99
    outputs:
 
100
      sha256_win: ${{ steps.sha256_win.outputs.sha256_win }}
 
101
      sha512_win: ${{ steps.sha512_win.outputs.sha512_win }}
 
102
 
 
103
    steps:
 
104
    - uses: actions/checkout@v2
 
105
    # reason to choose 3.4: https://media.discordapp.net/attachments/807245652072857613/942409077701619742/unknown.png
 
106
    - name: Set up Python 3.4
 
107
      uses: actions/setup-python@v2
 
108
      with:
 
109
        python-version: '3.4'
 
110
        architecture: 'x86'
 
111
    - name: Install packages
 
112
      # https://setuptools.pypa.io/en/latest/history.html#v44-0-0
 
113
      # https://pypi.org/project/py2exe/0.9.2.2/
 
114
      # https://pip.pypa.io/en/stable/news/#v19-2
 
115
      # https://wheel.readthedocs.io/en/stable/news.html
 
116
      run: python -m pip install --upgrade "pip<19.2" "setuptools<44" "wheel<0.34.0" py2exe==0.9.2.2
 
117
    - name: Bump version
 
118
      id: bump_version
 
119
      env:
 
120
        version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
 
121
      run: python devscripts/update-version.py ${{ env.version_suffix }}
 
122
    # - name: Run PyInstaller Script
 
123
    #   run: python -m PyInstaller --onefile --console --distpath dist/ -n youtube-dl youtube_dl\__main__.py
 
124
    - name: Build EXE file
 
125
      run: python setup.py py2exe
 
126
    - name: Upload youtube-dl.exe Windows binary
 
127
      id: upload-release-windows
 
128
      uses: actions/upload-release-asset@v1
 
129
      env:
 
130
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
131
      with:
 
132
        upload_url: ${{ needs.build_unix.outputs.upload_url }}
 
133
        asset_path: ./youtube-dl.exe
 
134
        asset_name: youtube-dl.exe
 
135
        asset_content_type: application/vnd.microsoft.portable-executable
 
136
    - name: Get SHA2-256SUMS for youtube-dl.exe
 
137
      id: sha256_win
 
138
      run: echo "::set-output name=sha256_win::$((Get-FileHash youtube-dl.exe -Algorithm SHA256).Hash.ToLower())"
 
139
    - name: Get SHA2-512SUMS for youtube-dl.exe
 
140
      id: sha512_win
 
141
      run: echo "::set-output name=sha512_win::$((Get-FileHash youtube-dl.exe -Algorithm SHA512).Hash.ToLower())"
 
142
 
 
143
  finish:
 
144
    runs-on: ubuntu-latest
 
145
    needs: [build_unix, build_windows]
 
146
    env:
 
147
      YTDL_VERSION: ${{ needs.build_unix.outputs.ytdl_version }}
 
148
 
 
149
    steps:
 
150
    - name: Make SHA2-256SUMS file
 
151
      env:
 
152
        SHA256_BIN: ${{ needs.build_unix.outputs.sha256_bin }}
 
153
        SHA256_TAR: ${{ needs.build_unix.outputs.sha256_tar }}
 
154
        SHA256_WIN: ${{ needs.build_windows.outputs.sha256_win }}
 
155
      run: |
 
156
        echo "${{ env.SHA256_BIN }}  youtube-dl" >> SHA2-256SUMS
 
157
        echo "${{ env.SHA256_TAR }}  youtube-dl-${YTDL_VERSION}.tar.gz" >> SHA2-256SUMS
 
158
        echo "${{ env.SHA256_WIN }}  youtube-dl.exe" >> SHA2-256SUMS
 
159
    - name: Upload 256SUMS file
 
160
      id: upload-sums
 
161
      uses: actions/upload-release-asset@v1
 
162
      env:
 
163
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
164
      with:
 
165
        upload_url: ${{ needs.build_unix.outputs.upload_url }}
 
166
        asset_path: ./SHA2-256SUMS
 
167
        asset_name: SHA2-256SUMS
 
168
        asset_content_type: text/plain
 
169
    - name: Make SHA2-512SUMS file
 
170
      env:
 
171
        SHA512_BIN: ${{ needs.build_unix.outputs.sha512_bin }}
 
172
        SHA512_TAR: ${{ needs.build_unix.outputs.sha512_tar }}
 
173
        SHA512_WIN: ${{ needs.build_windows.outputs.sha512_win }}
 
174
      run: |
 
175
        echo "${{ env.SHA512_BIN }}  youtube-dl" >> SHA2-512SUMS
 
176
        echo "${{ env.SHA512_TAR }}  youtube-dl-${YTDL_VERSION}.tar.gz" >> SHA2-512SUMS
 
177
        echo "${{ env.SHA512_WIN }}  youtube-dl.exe" >> SHA2-512SUMS
 
178
    - name: Upload 512SUMS file
 
179
      id: upload-512sums
 
180
      uses: actions/upload-release-asset@v1
 
181
      env:
 
182
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
183
      with:
 
184
        upload_url: ${{ needs.build_unix.outputs.upload_url }}
 
185
        asset_path: ./SHA2-512SUMS
 
186
        asset_name: SHA2-512SUMS
 
187
        asset_content_type: text/plain