Repository navigation
98 lines (96 loc) · 3.21 KB
/
Copy pathmain.yml
File metadata and controls
98 lines (96 loc) · 3.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
on: push
name: Clippy check
jobs:
clippy_check:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
use-cross: true
rustmt_check:
name: Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
target:
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v1
name: Clone
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- uses: actions-rs/cargo@v1
name: Build
with:
use-cross: true
command: build
args: --release --all-features --target=${{ matrix.target }}
# Env setup!
- name: Configure packaging name for git master branch
if: ${{ github.ref == 'refs/heads/master' }}
run: |
echo "release_tag=git`date +%Y%m%d`" >> $GITHUB_ENV
echo "release_name=preview" >> $GITHUB_ENV
- name: Configure packaging name for tag
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo "release_tag=`basename $GITHUB_REF`" >> $GITHUB_ENV
echo "release_name=`basename $GITHUB_REF`" >> $GITHUB_ENV
- name: Configure packaging name for non-releasing branch
if: ${{ (github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) || github.repository_owner != 'ComputerScienceHouse' }}
run: |
echo "release_tag=" >> $GITHUB_ENV
echo "release_name=" >> $GITHUB_ENV
- name: Check for prerelease
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'rc') || contains(github.ref, 'beta') }}
run: |
echo "release_pre=true" >> $GITHUB_ENV
- name: Check for non-prerelease
if: ${{ github.ref != 'refs/heads/master' && !contains(github.ref, 'rc') && !contains(github.ref, 'beta') }}
run: |
echo "release_pre=false" >> $GITHUB_ENV
- name: Show packaging name
run: |
echo "${{ env.release_tag }}"
echo "${{ env.release_name }}"
echo "${{ env.release_pre }}"
- name: Rename artifacts
run: |
mv target/${{ matrix.target }}/release/clink clink-release-${{ matrix.target }}
- name: Create Release
if: ${{ env.release_tag != '' }}
uses: ncipollo/release-action@v1
with:
artifacts: "clink-release-${{ matrix.target }}"
tag: ${{ env.release_tag }}
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
allowUpdates: true
prerelease: ${{ env.release_pre }}