-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.yml
129 lines (129 loc) · 2.88 KB
/
config.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
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
version: 2
jobs:
check:
docker:
- image: circleci/rust:1.39-buster
steps:
- checkout
- restore_cache:
key: check-cache
- run:
name: Check
command: cargo check
- save_cache:
key: check-cache
paths:
- "~/.cargo"
- "./target"
build:
docker:
- image: circleci/rust:1.39-buster
steps:
- checkout
- run:
name: Build
command: RUSTFLAGS="-C link-arg=-s" cargo build --release
- persist_to_workspace:
root: target/release
paths:
- cd-to-csv
- cd-to-notice
- cl-to-cd
publish-crate:
docker:
- image: circleci/rust:1.39-buster
steps:
- checkout
- run:
name: Setup Version
command: sed -i "s/0.0.0/${CIRCLE_TAG}/" Cargo.toml
- run:
name: Publish
command: |
cargo login ${CRATES_TOKEN}
cargo publish --allow-dirty
notice:
docker:
- image: circleci/rust:1.39-buster
steps:
- checkout:
- run:
name: Install Tools
command: cargo install cl-to-cd
- run:
name: Generate Notice
command: cat Cargo.lock | cl-to-cd | cd-to-notice > notice.txt
- persist_to_workspace:
root: .
paths:
- notice.txt
- LICENSE
- README.md
publish:
docker:
- image: cibuilds/github:0.13
steps:
- attach_workspace:
at: workspace
- run:
name: Tarball
command: |
NAME=cl-to-cd_${CIRCLE_TAG}_linux_x86_64
mkdir ${NAME}
cp workspace/* ${NAME}
tar -czvf ${NAME}.tar.gz ${NAME}/*
- run:
name: Publish
command: |
if [[ ${CIRCLE_TAG} = *alpha* || ${CIRCLE_TAG} = *beta* ]]; then
PRE=-prerelease
else
PRE=
fi
ghr \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
${PRE} \
${CIRCLE_TAG} *.tar.gz
workflows:
version: 2
check:
jobs:
- check:
filters:
branches:
only: master
build-and-publish:
jobs:
- publish-crate:
filters:
branches:
ignore: /.*/
tags:
only:
- /[0-9]+\.[0-9]+\.[0-9]+.*/
- notice:
filters:
branches:
ignore: /.*/
tags:
only:
- /[0-9]+\.[0-9]+\.[0-9]+.*/
- build:
filters:
branches:
ignore: /.*/
tags:
only:
- /[0-9]+\.[0-9]+\.[0-9]+.*/
- publish:
requires:
- build
- notice
filters:
branches:
ignore: /.*/
tags:
only:
- /[0-9]+\.[0-9]+\.[0-9]+.*/