-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (89 loc) · 2.57 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
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
name: CD
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ACTIONS_RUNTIME_TOKEN: dummy
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Ensure no changes (1)
run: git diff --exit-code --quiet && cargo check
continue-on-error: true
- name: Git status
if: failure()
run: git status && exit 1
- name: Setup Git
run: |
git config user.name "Linus Oleander"
git config user.email "[email protected]"
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
override: true
profile: minimal
- name: Install cargo-bump
run: cargo install cargo-bump
- name: Ensure no changes
run: git diff --exit-code --quiet && cargo check
- name: Git status
if: failure()
run: git status && exit 1
- name: Build for target
run: cargo build -Z unstable-options --profile dev --artifact-dir bin --target ${{ matrix.target }}
- name: List all targets
run: |
ls -halt bin/
pwd
realpath bin/
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-${{ github.run_number }}
if-no-files-found: error
path: |
bin/git-ai
bin/git-ai-hook
- name: Print the artifact URL
run: echo ${{ steps.upload-artifact.outputs.artifact-url }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
- name: Bump version
run: |
cargo bump patch --git-tag
cargo check
- name: Include the version bump in the commit message
run: git commit -a --amend --no-edit
- name: Publish to crates.io
run: cargo publish --allow-dirty
- name: Push to origin
run: git push origin HEAD --tags