-
-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (149 loc) · 4.53 KB
/
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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
## references:
# cache: https://github.com/actions/cache/blob/main/examples.md#rust---cargo
# audit: https://github.com/actions-rs/audit-check
# "needs": https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-beta.[0-9]+'
paths-ignore:
- "**/docs/**"
- "**.md"
# NOTE: needs to stay in sync with ./build.yml
jobs:
check:
name: check
strategy:
fail-fast: false
matrix:
version: [ 'ubuntu-latest']
runs-on: ${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v1
- run: cargo check
lint:
name: lint
needs: check
strategy:
fail-fast: false
matrix:
version: [ 'ubuntu-latest']
cargo-cmd:
- fmt --all -- --check
- clippy --all-targets --all-features -- -D warnings
runs-on: ${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v1
- run: cargo ${{ matrix['cargo-cmd'] }}
tests:
name: test
needs: check
strategy:
fail-fast: false
matrix:
version: [ 'macos-latest', 'ubuntu-latest', 'windows-latest']
rust: [ nightly, stable ]
runs-on: ${{ matrix.version }}
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: cargo test
run: cargo test --all-features
audit:
name: security audit
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# END of build.yml
publish:
name: post / cargo publish
needs: [audit, lint, tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
release:
name: post / github release
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup | rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Get version from tag
id: tag_name
run: echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
shell: bash
- name: Get Changelog Entry
id: changelog_reader
# https://github.com/marketplace/actions/changelog-reader
uses: mindsers/changelog-reader-action@v2
with:
validation_depth: 10
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}