Skip to content

Commit ea1ae5f

Browse files
committed
ci: add release for mac workflow
1 parent a80eb34 commit ea1ae5f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
jobs:
6+
release:
7+
name: release ${{ matrix.target }}
8+
runs-on: macos-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- target: x86_64-apple-darwin
14+
archive: tar.gz tar.xz
15+
16+
steps:
17+
- uses: actions/checkout@master
18+
- uses: Swatinem/rust-cache@v2
19+
- name: Installing needed dependencies
20+
run: brew install protobuf
21+
- name: Running cargo build
22+
uses: actions-rs/cargo@v1
23+
with:
24+
command: build
25+
toolchain: stable
26+
args: --release --target ${{ matrix.target }}"
27+
- name: Set env
28+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
29+
- name: Packaging final binary
30+
shell: bash
31+
run: |
32+
cd target/${{ matrix.target }}/release
33+
tar czvf music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz music-player
34+
shasum -a 256 music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz > music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz.sha256
35+
- name: Releasing assets
36+
uses: softprops/action-gh-release@v1
37+
with:
38+
files: |
39+
target/${{ matrix.target }}/release/music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz
40+
target/${{ matrix.target }}/release/music-player_${{ env.RELEASE_VERSION }}_${{ matrix.target }}.tar.gz.sha256
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)