-
Notifications
You must be signed in to change notification settings - Fork 269
76 lines (73 loc) · 3.02 KB
/
dispatch-build.yml
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
name: Build
env:
PROJECT_NAME: code2prompt
PROJECT_DESC: "A command-line tool to generate an LLM prompt from codebases of any size, fast."
PROJECT_AUTH: "mufeedvh"
on:
workflow_dispatch:
release:
types: [published]
jobs:
build:
name: Build
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
# { os, target, cargo-options, features, use-cross, toolchain }
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , use-cross: use-cross }
- { os: ubuntu-latest , target: aarch64-unknown-linux-gnu , use-cross: use-cross }
- { os: ubuntu-latest , target: i686-unknown-linux-gnu , use-cross: use-cross }
- { os: ubuntu-latest , target: i686-unknown-linux-musl , use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , use-cross: use-cross }
- { os: macos-latest , target: x86_64-apple-darwin }
- { os: macos-latest , target: aarch64-apple-darwin }
- { os: windows-latest , target: i686-pc-windows-gnu }
- { os: windows-latest , target: i686-pc-windows-msvc }
- { os: windows-latest , target: x86_64-pc-windows-gnu }
- { os: windows-latest , target: x86_64-pc-windows-msvc }
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.job.target }}
override: true
default: true
- name: Install cross-compilation dependencies
if: matrix.job.target == 'arm-unknown-linux-gnueabihf' || matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
- name: Build release binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --release --target ${{ matrix.job.target }} --verbose
- name: Strip release binary (unix)
if: matrix.job.target != 'x86_64-pc-windows-msvc'
run: strip "target/${{ matrix.job.target }}/release/code2prompt"
- name: Get latest release
id: latest_release
uses: actions/github-script@v6
with:
script: |
const releases = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 1
});
return releases.data[0].id;
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
release_id: ${{ steps.latest_release.outputs.result }}
files: |
target/${{ matrix.job.target }}/release/code2prompt${{ matrix.job.target == 'x86_64-pc-windows-msvc' && '.exe' || '' }}
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}