]> git.madduck.net Git - etc/vim.git/blob - .github/workflows/upload_binary.yml

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Mention CHANGES.md in PR template explicitly (#3295)
[etc/vim.git] / .github / workflows / upload_binary.yml
1 name: Publish executables
2
3 on:
4   release:
5     types: [published]
6
7 permissions:
8   contents: write # actions/upload-release-asset needs this.
9
10 jobs:
11   build:
12     runs-on: ${{ matrix.os }}
13     strategy:
14       fail-fast: false
15       matrix:
16         os: [windows-2019, ubuntu-20.04, macos-latest]
17         include:
18           - os: windows-2019
19             pathsep: ";"
20             asset_name: black_windows.exe
21             executable_mime: "application/vnd.microsoft.portable-executable"
22           - os: ubuntu-20.04
23             pathsep: ":"
24             asset_name: black_linux
25             executable_mime: "application/x-executable"
26           - os: macos-latest
27             pathsep: ":"
28             asset_name: black_macos
29             executable_mime: "application/x-mach-binary"
30
31     steps:
32       - uses: actions/checkout@v3
33
34       - name: Set up latest Python
35         uses: actions/setup-python@v4
36         with:
37           python-version: "*"
38
39       - name: Install Black and PyInstaller
40         run: |
41           python -m pip install --upgrade pip wheel
42           python -m pip install .[colorama]
43           python -m pip install pyinstaller
44
45       - name: Build executable with PyInstaller
46         run: >
47           python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data
48           'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py
49
50       - name: Quickly test executable
51         run: |
52           ./dist/${{ matrix.asset_name }} --version
53           ./dist/${{ matrix.asset_name }} src --verbose
54
55       - name: Upload binary as release asset
56         uses: actions/upload-release-asset@v1
57         env:
58           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59         with:
60           upload_url: ${{ github.event.release.upload_url }}
61           asset_path: dist/${{ matrix.asset_name }}
62           asset_name: ${{ matrix.asset_name }}
63           asset_content_type: ${{ matrix.executable_mime }}