-
-
Notifications
You must be signed in to change notification settings - Fork 7
136 lines (134 loc) · 5.52 KB
/
build_release_binaries.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Upload release assets
on:
release:
types:
- published
push:
tags:
- 'v*'
jobs:
find_latest_pyinstaller:
name: Get latest pyinstaller version
runs-on: ubuntu-latest
outputs:
tagname: ${{ steps.get_tagname.outputs.tagname }}
steps:
- name: Get latest tag name
id: get_tagname
run: |
curl -L https://api.github.com/repos/pyinstaller/pyinstaller/releases/latest -o releases.json
printf %s tagname= >> "$GITHUB_OUTPUT"
jq -r .tag_name releases.json >> "$GITHUB_OUTPUT"
jq -r .tag_name releases.json
build_and_upload_assets:
name: Build and upload binary assets
needs: find_latest_pyinstaller
runs-on : ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- name: Setup dependencies
run: |
pip install wheel
pip install -r requirements.txt
- name: Fetch pyinstaller
run: ${{ matrix.fetch_pyinstaller_command }}
env:
PYINSTALLER_TAG: ${{ needs.find_latest_pyinstaller.outputs.tagname }}
- name: Setup pyinstaller
run: |
cd pyinstaller
cd bootloader
python waf all
cd ..
pip install .
cd ..
- name: Build binary
run: pyinstaller --onefile --distpath . binary.py --name nvim-ghost-binary
- name: Build package
run: ${{ matrix.packaging_command }}
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload release asset
run: ${{ matrix.upload_command }}
env:
ASSET_PATH: ${{ matrix.asset_path }}
ASSET_NAME: ${{ matrix.asset_name }}
ASSET_TYPE: ${{ matrix.asset_type }}
RELEASE_ID: ${{ steps.get_release.outputs.id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
target: macos
asset_name: nvim-ghost-macos.tar.gz
asset_path: binary.tar.gz
asset_type: application/gzip
packaging_command: |
cp binary_version nvim-ghost-binary.version
tar -czf binary.tar.gz nvim-ghost-binary nvim-ghost-binary.version
upload_command: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN"\
-H "Content-Type: $ASSET_TYPE" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$ASSET_NAME" \
--data-binary "@$ASSET_PATH"
fetch_pyinstaller_command: |
curl -Lo pyinstaller.tar.gz "https://github.com/pyinstaller/pyinstaller/archive/refs/tags/$PYINSTALLER_TAG.tar.gz"
tar xvf pyinstaller.tar.gz
mv "pyinstaller-${PYINSTALLER_TAG#v}" pyinstaller
- os: ubuntu-latest
target: linux
asset_name: nvim-ghost-linux.tar.gz
asset_path: binary.tar.gz
asset_type: application/gzip
packaging_command: |
cp binary_version nvim-ghost-binary.version
tar -czf binary.tar.gz nvim-ghost-binary nvim-ghost-binary.version
upload_command: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN"\
-H "Content-Type: $ASSET_TYPE" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$ASSET_NAME" \
--data-binary "@$ASSET_PATH"
fetch_pyinstaller_command: |
curl -Lo pyinstaller.tar.gz "https://github.com/pyinstaller/pyinstaller/archive/refs/tags/$PYINSTALLER_TAG.tar.gz"
tar xvf pyinstaller.tar.gz
mv "pyinstaller-${PYINSTALLER_TAG#v}" pyinstaller
- os: windows-latest
target: win
asset_name: nvim-ghost-win64.zip
asset_path: binary.zip
asset_type: application/zip
packaging_command: |
Copy-Item binary_version nvim-ghost-binary.exe.version
7z a -tzip binary.zip nvim-ghost-binary.exe nvim-ghost-binary.exe.version
upload_command: |
Invoke-WebRequest `
-Method POST `
-Headers @{
Accept = "application/vnd.github+json"
Authorization = "Bearer $Env:GITHUB_TOKEN"
'Content-Type' = "$Env:ASSET_TYPE"
'X-GitHub-Api-Version' = "2022-11-28"
} `
-Uri "https://uploads.github.com/repos/$Env:GITHUB_REPOSITORY/releases/$Env:RELEASE_ID/assets?name=$Env:ASSET_NAME" `
-InFile "$Env:ASSET_PATH"
fetch_pyinstaller_command: |
Invoke-WebRequest -OutFile pyinstaller.zip -Uri "https://github.com/pyinstaller/pyinstaller/archive/refs/tags/$Env:PYINSTALLER_TAG.zip"
Expand-Archive pyinstaller.zip -DestinationPath .
Move-Item "pyinstaller-$($Env:PYINSTALLER_TAG.TrimStart('v'))" pyinstaller
# vim: nowrap et ts=2 sts=2 sw=2