-
-
Notifications
You must be signed in to change notification settings - Fork 28
131 lines (118 loc) · 4.33 KB
/
release.yml
File metadata and controls
131 lines (118 loc) · 4.33 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
on:
push:
tags:
- "*"
name: Release
jobs:
create-release:
name: "Create Release"
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
release:
name: "Release"
needs: create-release
strategy:
matrix:
target:
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
binary_path: target/x86_64-pc-windows-msvc/release/cli-candlestick-chart.exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
cross: false
binary_path: target/x86_64-unknown-linux-gnu/release/cli-candlestick-chart
- target: x86_64-apple-darwin
os: macos-latest
cross: false
binary_path: target/x86_64-apple-darwin/release/cli-candlestick-chart
runs-on: ${{ matrix.target.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Get the version
id: get_version
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Install libssl ubuntu
id: install_build_tools
if: matrix.target.os == 'ubuntu-latest'
run: |
echo ${{ matrix.target.os }}
sudo apt-get update
sudo apt-get install -y --no-install-recommends libssl-dev pkg-config
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target.target }}
override: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.target.cross }}
command: build
args: --release --bin=cli-candlestick-chart --features=bin-app --target=${{ matrix.target.target }}
- name: Copy release files
shell: bash
run: |
mkdir package
cp -R LICENSE README.md docs/ package/
cp ${{ matrix.target.binary_path }} package/
- name: Create Archive
shell: bash
if: matrix.target.os != 'windows-latest'
run: |
tar czvf cli-candlestick-chart-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target.target }}.tar.gz -C package/ .
- name: Create Archive (Windows)
if: matrix.target.os == 'windows-latest'
run: |
cd package; 7z.exe a ../cli-candlestick-chart-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target.target }}.zip .
- name: Upload Release Asset
if: matrix.target.os != 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./cli-candlestick-chart-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target.target }}.tar.gz
asset_name: cli-candlestick-chart-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target.target }}.tar.gz
asset_content_type: application/x-gzip
- name: Upload Release Asset (Windows)
if: matrix.target.os == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./cli-candlestick-chart-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target.target }}.zip
asset_name: cli-candlestick-chart-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target.target }}.zip
asset_content_type: application/zip
publish:
name: "Publish"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Publish cli-candlestick-chart
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_TOKEN }}