-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (68 loc) · 2.26 KB
/
cd.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
77
78
79
80
81
82
83
84
85
name: CD
on:
push:
tags:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build-x86:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build for x86_64-unknown-linux-gnu
run: |
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
- name: Package Binary
run: |
cd target/x86_64-unknown-linux-gnu/release
tar czf git-ai-x86_64-unknown-linux-gnu.tar.gz git-ai git-ai-hook
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: git-ai-x86_64-unknown-linux-gnu.tar.gz
path: target/x86_64-unknown-linux-gnu/release/git-ai-x86_64-unknown-linux-gnu.tar.gz
build-arm:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build for aarch64-apple-darwin
run: |
rustup target add aarch64-apple-darwin
cargo build --release --target aarch64-apple-darwin
- name: Package Binary
run: |
cd target/aarch64-apple-darwin/release
tar czf git-ai-aarch64-apple-darwin.tar.gz git-ai git-ai-hook
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: git-ai-aarch64-apple-darwin.tar.gz
path: target/aarch64-apple-darwin/release/git-ai-aarch64-apple-darwin.tar.gz
release:
needs: [build-x86, build-arm]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
git-ai-x86_64-unknown-linux-gnu.tar.gz/git-ai-x86_64-unknown-linux-gnu.tar.gz
git-ai-aarch64-apple-darwin.tar.gz/git-ai-aarch64-apple-darwin.tar.gz
draft: false
prerelease: false
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}