-
-
Notifications
You must be signed in to change notification settings - Fork 10
163 lines (132 loc) · 4.26 KB
/
Copy pathrelease-binaries.yml
File metadata and controls
163 lines (132 loc) · 4.26 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Build and Publish Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
env:
NODE_VERSION: 20
PYTHON_VERSION: "3.12"
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: darwin-arm64
runner: macos-latest
- target: linux-x64
runner: ubuntu-latest
- target: linux-arm64
runner: ubuntu-24.04-arm
- target: win-x64
runner: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e .
python -m pip install pyinstaller
- name: Build PyInstaller binary
run: python scripts/build_pyinstaller.py
# Generate checksum
- name: Generate checksum
shell: bash
run: |
cd node_version/dist/native/${{ matrix.target }}
for f in explainthisrepo*; do
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "$f" > "$f.sha256"
else
shasum -a 256 "$f" > "$f.sha256"
fi
done
- name: Upload native binary + checksum
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: node_version/dist/native/${{ matrix.target }}
release:
name: Publish npm and GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download native binaries
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Rehydrate native folder
shell: bash
run: |
mkdir -p node_version/dist/native dotnet_version/native release
for artifact in artifacts/*; do
[ -d "$artifact" ] || continue
target="$(basename "$artifact")"
mkdir -p "node_version/dist/native/$target"
mkdir -p "dotnet_version/native/$target"
cp "$artifact"/explainthisrepo* "node_version/dist/native/$target/"
cp "$artifact"/explainthisrepo* "dotnet_version/native/$target/"
cp "$artifact"/explainthisrepo* release/
done
# HARD STOP if tampered
- name: Verify checksums
shell: bash
run: |
for checksum in $(find node_version/dist/native -name '*.sha256' | sort); do
dir="$(dirname "$checksum")"
(
cd "$dir"
sha256sum -c "$(basename "$checksum")"
)
done
- name: Verify native binaries exist
shell: bash
run: |
find node_version/dist/native -type f | sort
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: node_version/package-lock.json
- name: Install Node deps
working-directory: node_version
run: npm ci
- name: Package check
working-directory: node_version
run: npm pack --dry-run
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build and Pack .NET Global Tool
working-directory: dotnet_version
run: dotnet pack -c Release
- name: Add .NET Tool Package to Release
shell: bash
run: cp dotnet_version/nupkg/*.nupkg release/
- name: Publish to NuGet (Optional)
working-directory: dotnet_version
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
if: ${{ env.NUGET_API_KEY != '' }}
run: dotnet nuget push nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release/*
generate_release_notes: true