Debian Codegraph @

.github/workflows/publish_binaries.yml

raw
1 name: publish binaries
2
3 on:
4 release:
5 types: [published]
6 workflow_dispatch:
7 inputs:
8 tag:
9 required: true
10 type: string
11
12 permissions: {}
13
14 jobs:
15 publish:
16 name: publish (${{ matrix.os }})
17 runs-on: ${{ matrix.os }}
18 strategy:
19 fail-fast: false
20 matrix:
21 include:
22 - os: windows-latest
23 pathsep: ";"
24 asset_name: black_windows.exe
25 executable_mime: "application/vnd.microsoft.portable-executable"
26 - os: windows-11-arm
27 pathsep: ";"
28 asset_name: black_windows-arm.exe
29 executable_mime: "application/vnd.microsoft.portable-executable"
30 - os: ubuntu-latest
31 pathsep: ":"
32 asset_name: black_linux
33 executable_mime: "application/x-executable"
34 - os: ubuntu-24.04-arm
35 pathsep: ":"
36 asset_name: black_linux-arm
37 executable_mime: "application/x-executable"
38 - os: macos-latest
39 pathsep: ":"
40 asset_name: black_macos
41 executable_mime: "application/x-mach-binary"
42 permissions:
43 contents: write # Needed to upload to release
44
45 steps:
46 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
47 with:
48 persist-credentials: false
49
50 - name: Set up latest Python
51 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
52 with:
53 python-version: "3.13"
54 pip-version: "25.3"
55 pip-install: .[colorama] --group pyinstaller
56
57 - name: Build executable with PyInstaller
58 run:
59 python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data
60 'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py
61
62 - name: Quickly test executable
63 run: |
64 ./dist/${{ matrix.asset_name }} --version
65 ./dist/${{ matrix.asset_name }} src --verbose
66
67 - run: gh release upload "$tag" dist/${{ matrix.asset_name }}
68 shell: bash
69 env:
70 GH_TOKEN: ${{ github.token }}
71 tag: ${{ inputs.tag || github.event.release.tag_name }}