-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.21 KB
/
release.yml
File metadata and controls
76 lines (63 loc) · 2.21 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
name: 🚀 Release Binaries
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
artifact: my_telegram_bot-${{ github.ref_name }}-linux-x86_64
suffix: ''
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: my_telegram_bot-${{ github.ref_name }}-windows-x86_64.exe
suffix: '.exe'
- os: macos-latest
target: x86_64-apple-darwin
artifact: my_telegram_bot-${{ github.ref_name }}-macos-x86_64
suffix: ''
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain (stable + components)
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
targets: ${{ matrix.target }}
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: 🔍 cargo fmt --check
run: cargo fmt --all -- --check
- name: 🧹 cargo clippy (deny warnings)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --verbose
- name: Strip symbols (Linux & macOS)
if: runner.os != 'Windows'
run: strip target/${{ matrix.target }}/release/my_telegram_bot${{ matrix.suffix }}
- name: Prepare artifact
shell: bash
run: |
cp "target/${{ matrix.target }}/release/my_telegram_bot${{ matrix.suffix }}" "${{ matrix.artifact }}"
if [[ "${{ runner.os }}" != "Windows" ]]; then
chmod +x "${{ matrix.artifact }}"
fi
- name: Upload binaries to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.artifact }}
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}