-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (111 loc) · 3.38 KB
/
Copy pathrelease.yml
File metadata and controls
129 lines (111 loc) · 3.38 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Release
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
name: Lint & Test
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Check format
run: cargo fmt -- --check
- name: Lint with Clippy
run: cargo clippy -- -D warnings
- name: Run Tests
run: cargo test
build:
name: Build / ${{ matrix.os }}
needs: tests
runs-on: ${{ matrix.os }}
if: github.ref == 'refs/heads/main'
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: pvm
asset_name: pvm-linux-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: pvm
asset_name: pvm-macos-aarch64
- os: macos-13
target: x86_64-apple-darwin
artifact_name: pvm
asset_name: pvm-macos-x86_64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Create tar.gz archive
shell: bash
run: tar -C target/${{ matrix.target }}/release -czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}.tar.gz
retention-days: 1
release:
name: Semantic Release
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Move artifacts to root
run: |
find artifacts -name "*.tar.gz" -exec mv {} . \;
ls -la *.tar.gz
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
with:
tag_format: v${version}
branches: |
['main']
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/github
@semantic-release/changelog
@semantic-release/git
@semantic-release/exec
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}