-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (48 loc) · 1.62 KB
/
Copy pathrelease.yml
File metadata and controls
56 lines (48 loc) · 1.62 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
name: release
# This workflow is triggered when a new tag is pushed to the repository.
# To create a new release, follow these steps:
# 1. Make sure all changes are committed and pushed to the main branch.
# 2. Tag the commit you want to release with a version number, e.g., `git tag v1.0.0`.
# 3. Push the tag to the remote repository: `git push origin v1.0.0`.
# 4. The workflow will be triggered automatically when the tag is pushed.
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
# Extract the version number from the tag
- name: Extract Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
# Update Cargo.toml with the extracted version
- name: Update Cargo.toml Version
run: |
sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" Cargo.toml
# Build the client binary.
- name: Build Client
run: cargo build --release --bin client
# Build the server binary.
- name: Build Server
run: cargo build --release --bin server
- name: Run Tests
run: cargo test --verbose
# Create a GitHub release with the built binaries.
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/client
target/release/server
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}