-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.84 KB
/
release.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
name: Build and Release
on:
push:
branches: [master] # Trigger only on pushes to the main branch
jobs:
build-and-release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
override: true
- name: Extract version from Cargo.toml
id: extract_version
run: |
Get-Content Cargo.toml | Select-String -Pattern '^version\s*=\s*"([^"]+)"' | ForEach-Object { $_.Matches[0].Groups[1].Value } | Set-Content -Path version.txt
echo ::set-output name=version::$(Get-Content version.txt)
- name: Get latest release version
id: get_latest_release
uses: octokit/[email protected]
with:
route: GET /repos/${{ github.repository }}/releases/latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build binaries
if: ${{ steps.extract_version.outputs.version != steps.get_latest_release.outputs.data.tag_name }}
run: |
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu
- name: Create release
if: ${{ steps.extract_version.outputs.version != steps.get_latest_release.outputs.data.tag_name }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_version.outputs.version }}
release_name: Release ${{ steps.extract_version.outputs.version }}
body: |
## Changes
## Downloads
- **Windows binary:** [link to Windows binary]
- **Linux binary:** [link to Linux binary]
draft: false
prerelease: false