-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (82 loc) · 2.53 KB
/
publish_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
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
on:
push:
tags:
- '*.*.*'
name: Publish
jobs:
build:
name: Build before publishing
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cargo build
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: build
args: --release
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Archive binary
run: tar cfJ rmq_monitor-${{ matrix.os }}-${{ steps.get_version.outputs.VERSION }}.tar.xz target/release/rmq_monitor
- name: Save archived binary as an artifact
uses: actions/upload-artifact@v2
with:
name: binaries
path: rmq_monitor-${{ matrix.os }}-${{ steps.get_version.outputs.VERSION }}.tar.xz
create_github_release:
name: Prepare a GitHub release
runs-on: ubuntu-latest
needs: build
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Download binaries from artifact
uses: actions/download-artifact@v2
with:
name: binaries
path: binaries
- name: Create release
uses: softprops/action-gh-release@v1
with:
name: rmq_monitor v${{ steps.get_version.outputs.VERSION }}
files: |
LICENSE
binaries/rmq_monitor-macOS-latest-${{ steps.get_version.outputs.VERSION }}.tar.xz
binaries/rmq_monitor-ubuntu-latest-${{ steps.get_version.outputs.VERSION }}.tar.xz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_crate:
name: Publish rmq_monitor to crates.io
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout latest master
uses: actions/checkout@master
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Login to crates.io
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: login
args: ${{ secrets.CRATES_TOKEN }}
- name: Publish to crates.io
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: publish