]> jfr.im git - yt-dlp.git/blob - .github/workflows/build.yml
Refactor `update-version`, `pyinst.py` and related files
[yt-dlp.git] / .github / workflows / build.yml
1 name: Build
2
3 on:
4 push:
5 branches:
6 - release
7
8 jobs:
9 build_unix:
10
11 runs-on: ubuntu-latest
12
13 outputs:
14 ytdlc_version: ${{ steps.bump_version.outputs.ytdlc_version }}
15 upload_url: ${{ steps.create_release.outputs.upload_url }}
16 sha2_unix: ${{ steps.sha2_file.outputs.sha2_unix }}
17
18 steps:
19 - uses: actions/checkout@v2
20 - name: Set up Python
21 uses: actions/setup-python@v2
22 with:
23 python-version: '3.8'
24 - name: Install packages
25 run: sudo apt-get -y install zip pandoc man
26 - name: Bump version
27 id: bump_version
28 run: python devscripts/update-version.py
29 - name: Print version
30 run: echo "${{ steps.bump_version.outputs.ytdlc_version }}"
31 - name: Run Make
32 run: make
33 - name: Create Release
34 id: create_release
35 uses: actions/create-release@v1
36 env:
37 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 with:
39 tag_name: ${{ steps.bump_version.outputs.ytdlc_version }}
40 release_name: yt-dlp ${{ steps.bump_version.outputs.ytdlc_version }}
41 body: |
42 Changelog:
43 PLACEHOLDER
44 draft: false
45 prerelease: false
46 - name: Upload youtube-dlc Unix binary
47 id: upload-release-asset
48 uses: actions/upload-release-asset@v1
49 env:
50 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51 with:
52 upload_url: ${{ steps.create_release.outputs.upload_url }}
53 asset_path: ./youtube-dlc
54 asset_name: youtube-dlc
55 asset_content_type: application/octet-stream
56 - name: Get SHA2-256SUMS for youtube-dlc
57 id: sha2_file
58 env:
59 SHA2: ${{ hashFiles('youtube-dlc') }}
60 run: echo "::set-output name=sha2_unix::$SHA2"
61 - name: Install dependencies for pypi
62 run: |
63 python -m pip install --upgrade pip
64 pip install setuptools wheel twine
65 - name: Build and publish on pypi
66 env:
67 TWINE_USERNAME: __token__
68 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
69 run: |
70 rm -rf dist/*
71 python setup.py sdist bdist_wheel
72 twine upload dist/*
73
74 build_windows:
75
76 runs-on: windows-latest
77
78 needs: build_unix
79
80 steps:
81 - uses: actions/checkout@v2
82 - name: Set up Python
83 uses: actions/setup-python@v2
84 with:
85 python-version: '3.8'
86 - name: Install Requirements
87 run: pip install pyinstaller mutagen
88 - name: Bump version
89 id: bump_version
90 run: python devscripts/update-version.py
91 - name: Print version
92 run: echo "${{ steps.bump_version.outputs.ytdlc_version }}"
93 - name: Run PyInstaller Script
94 run: python devscripts/pyinst.py 64
95 - name: Upload youtube-dlc.exe Windows binary
96 id: upload-release-windows
97 uses: actions/upload-release-asset@v1
98 env:
99 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100 with:
101 upload_url: ${{ needs.build_unix.outputs.upload_url }}
102 asset_path: ./dist/youtube-dlc.exe
103 asset_name: youtube-dlc.exe
104 asset_content_type: application/vnd.microsoft.portable-executable
105 - name: Get SHA2-256SUMS for youtube-dlc.exe
106 id: sha2_file_win
107 env:
108 SHA2_win: ${{ hashFiles('dist/youtube-dlc.exe') }}
109 run: echo "::set-output name=sha2_windows::$SHA2_win"
110
111 build_windows32:
112
113 runs-on: windows-latest
114
115 needs: [build_unix, build_windows]
116
117 steps:
118 - uses: actions/checkout@v2
119 - name: Set up Python 3.4.4 32-Bit
120 uses: actions/setup-python@v2
121 with:
122 python-version: '3.4.4'
123 architecture: 'x86'
124 - name: Install Requirements for 32 Bit
125 run: pip install pyinstaller==3.5 mutagen
126 - name: Bump version
127 id: bump_version
128 run: python devscripts/update-version.py
129 - name: Print version
130 run: echo "${{ steps.bump_version.outputs.ytdlc_version }}"
131 - name: Run PyInstaller Script for 32 Bit
132 run: python devscripts/pyinst.py 32
133 - name: Upload Executable youtube-dlc_x86.exe
134 id: upload-release-windows32
135 uses: actions/upload-release-asset@v1
136 env:
137 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138 with:
139 upload_url: ${{ needs.build_unix.outputs.upload_url }}
140 asset_path: ./dist/youtube-dlc_x86.exe
141 asset_name: youtube-dlc_x86.exe
142 asset_content_type: application/vnd.microsoft.portable-executable
143 - name: Get SHA2-256SUMS for youtube-dlc_x86.exe
144 id: sha2_file_win32
145 env:
146 SHA2_win32: ${{ hashFiles('dist/youtube-dlc_x86.exe') }}
147 run: echo "::set-output name=sha2_windows32::$SHA2_win32"
148 - name: Make SHA2-256SUMS file
149 env:
150 SHA2_WINDOWS: ${{ needs.build_windows.outputs.sha2_windows }}
151 SHA2_WINDOWS32: ${{ steps.sha2_file_win32.outputs.sha2_windows32 }}
152 SHA2_UNIX: ${{ needs.build_unix.outputs.sha2_unix }}
153 YTDLC_VERSION: ${{ needs.build_unix.outputs.ytdlc_version }}
154 run: |
155 echo "version:${env:YTDLC_VERSION}" >> SHA2-256SUMS
156 echo "youtube-dlc.exe:${env:SHA2_WINDOWS}" >> SHA2-256SUMS
157 echo "youtube-dlc_x86.exe:${env:SHA2_WINDOWS32}" >> SHA2-256SUMS
158 echo "youtube-dlc:${env:SHA2_UNIX}" >> SHA2-256SUMS
159
160 - name: Upload 256SUMS file
161 id: upload-sums
162 uses: actions/upload-release-asset@v1
163 env:
164 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165 with:
166 upload_url: ${{ needs.build_unix.outputs.upload_url }}
167 asset_path: ./SHA2-256SUMS
168 asset_name: SHA2-256SUMS
169 asset_content_type: text/plain
170
171 # update_version_badge:
172 # runs-on: ubuntu-latest
173 # needs: build_unix
174 # steps:
175 # - name: Create Version Badge
176 # uses: schneegans/dynamic-badges-action@v1.0.0
177 # with:
178 # auth: ${{ secrets.GIST_TOKEN }}
179 # gistID: c69cb23c3c5b3316248e52022790aa57
180 # filename: version.json
181 # label: Version
182 # message: ${{ needs.build_unix.outputs.ytdlc_version }}