-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (83 loc) · 2.45 KB
/
release.yml
File metadata and controls
94 lines (83 loc) · 2.45 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
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: windows-latest
goos: windows
goarch: amd64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Prepare dist
shell: bash
run: mkdir -p dist
- name: Download ONNX Runtime (windows only)
if: matrix.goos == 'windows'
shell: pwsh
run: |
$ver="1.22.0"
$url="https://github.com/microsoft/onnxruntime/releases/download/v$ver/onnxruntime-win-x64-$ver.zip"
Invoke-WebRequest -Uri $url -OutFile ort.zip
Expand-Archive ort.zip -DestinationPath ort
$dll = Get-ChildItem -Recurse -Filter onnxruntime.dll -Path ort | Select-Object -First 1
if (-not $dll) { Write-Error "onnxruntime.dll not found in archive"; exit 1 }
Copy-Item $dll.FullName dist\onnxruntime.dll
- name: Build
shell: bash
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 1
WINDOWS: ${{ matrix.goos == 'windows' && '1' || '0' }}
run: |
if [ "$GOOS" = "windows" ]; then
make build-windows
else
make build-linux
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/hf_transformers_go-${{ matrix.goos }}-${{ matrix.goarch }}*
dist/onnxruntime.dll
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: List artifacts
run: ls -R dist
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: |
dist/**/hf_transformers_go-linux-amd64
dist/**/hf_transformers_go-windows-amd64.exe
dist/**/onnxruntime.dll
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}