Skip to content

Commit ebbc7e8

Browse files
committed
Add release workflow
1 parent af9cda5 commit ebbc7e8

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/release.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
RUST_BACKTRACE: 1
11+
12+
defaults:
13+
run:
14+
shell: bash
15+
16+
jobs:
17+
release:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-18.04, macos-latest, windows-2019]
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Install packages (Ubuntu)
25+
if: matrix.os == 'ubuntu-18.04'
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install libdbus-1-dev
29+
- name: Install Rust
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
profile: minimal
33+
toolchain: stable
34+
override: true
35+
- name: Build release binary
36+
uses: actions-rs/cargo@v1
37+
with:
38+
command: build
39+
args: --release
40+
- name: Strip release binary (Ubuntu and macOS)
41+
if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-latest'
42+
run: strip "target/${{ matrix.target }}/release/edu-sync-cli"
43+
- name: Rename binaries
44+
run: |
45+
VERSION=${GITHUB_REF#refs/tags/}
46+
cd target/release
47+
if [ "${{ matrix.os }}" = "ubuntu-18.04" ]; then
48+
BINARY=edu-sync-cli-$VERSION-linux
49+
mv edu-sync-cli $BINARY
50+
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
51+
BINARY=edu-sync-cli-$VERSION-macos
52+
mv edu-sync-cli $BINARY
53+
elif [ "${{ matrix.os }}" = "windows-2019" ]; then
54+
BINARY=edu-sync-cli-$VERSION-win.exe
55+
mv edu-sync-cli.exe $BINARY
56+
else
57+
exit 1
58+
fi
59+
echo "BINARY=target/release/$BINARY" >> $GITHUB_ENV
60+
- name: Upload release archive
61+
uses: softprops/action-gh-release@v1
62+
with:
63+
files: ${{ env.BINARY }}
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)