-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (71 loc) · 2.28 KB
/
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
name: build
on:
push:
branches:
- master
- main
tags:
- v*
pull_request:
branches:
- master
- main
permissions:
contents: write
jobs:
build-rust:
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install Rust
run: rustup toolchain install stable --component llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: install nextest
uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Check code format
run: cargo fmt -- --check
- name: Check the package for errors
run: cargo check --all
- name: Lint rust sources
run: cargo clippy --all-targets --all-features --tests --benches -- -D warnings
- name: Execute rust tests
run: cargo nextest run --all-features
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
if: startsWith(github.ref, 'refs/tags/')
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: NEW_CHANGELOG.md
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body: ${{ steps.git-cliff.outputs.content }}
- name: Prepend new changelog to existing CHANGELOG.md
run: |
git fetch origin master:master
git checkout master
sed -i -e '1{/^---$/d}' -e '${/^---$/d}' NEW_CHANGELOG.md
if [ -f "CHANGELOG.md" ]; then
cat NEW_CHANGELOG.md CHANGELOG.md > TEMP_CHANGELOG.md && mv TEMP_CHANGELOG.md CHANGELOG.md
else
mv NEW_CHANGELOG.md CHANGELOG.md
fi
rm -rf NEW_CHANGELOG.md
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add CHANGELOG.md
git commit -m "[skip] Update CHANGELOG.md with new changes"
git push origin master --force
if: startsWith(github.ref, 'refs/tags/') && steps.git-cliff.outputs.content != ''