-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (69 loc) · 2.33 KB
/
rust.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: release
on:
push:
tags:
- "v*"
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
publish:
name: publish ${{ matrix.name }}
needs:
- release
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-pc-windows-gnu
suffix: windows-x86_64
platform: windows-latest
archive: zip
name: x86_64-pc-windows-gnu
- target: x86_64-unknown-linux-gnu
suffix: linux-x86_64
platform: ubuntu-latest
archive: tar.gz
name: x86_64-unknown-linux-gnu
- target: x86_64-apple-darwin
suffix: darwin-x86_64
platform: macos-latest
archive: tar.gz
name: x86_64-apple-darwin
runs-on: ${{ matrix.platform }}
steps:
- name: Clone test repository
uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
- name: Build
run: cargo +nightly -Z unstable-options b -r --out-dir ./release
- name: Collect windows artifacts
if: matrix.platform == 'windows-latest'
run: |
cp $env:GITHUB_WORKSPACE/.env.example $env:GITHUB_WORKSPACE/release/.env
Compress-Archive -Path $env:GITHUB_WORKSPACE/release/* -DestinationPath $env:GITHUB_WORKSPACE/mosquitoswatter_${{ matrix.name }}.${{ matrix.archive }}
- name: Collect linux/macos artifacts
if: matrix.platform != 'windows-latest'
run: |
cp $env:GITHUB_WORKSPACE/.env.example $env:GITHUB_WORKSPACE/release/.env
tar -czvf ${GITHUB_WORKSPACE}/mosquitoswatter_${{ matrix.name }}.${{ matrix.archive }} -C ${GITHUB_WORKSPACE}/release/ .
- name: Upload artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "mosquitoswatter_${{ matrix.name }}.${{ matrix.archive }}"