-
Notifications
You must be signed in to change notification settings - Fork 9
214 lines (176 loc) · 6.03 KB
/
publish.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Publish
on:
workflow_dispatch:
inputs:
publish_razy_importer:
type: boolean
description: 'Publish razy-importer'
required: false
publish_razy_importer_macros:
type: boolean
description: 'Publish razy-importer-macros'
required: false
env:
RUST_CACHE_GUID: '12819416-15ec-4b87-8b0e-53904c15b18d'
jobs:
publish:
name: Publish
if: ${{ inputs.publish_razy_importer || inputs.publish_razy_importer_macros }}
strategy:
matrix:
os: [windows-latest]
rust_toolchain: [stable]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_toolchain }}
components: rust-src
override: true
- name: cache rust
uses: Swatinem/rust-cache@v2
with:
workspaces: |
./razy-importer -> target
./razy-importer-macros -> target
shared-key: ${{ env.RUST_CACHE_GUID }}
- name: install cargo-audit
run: cargo install cargo-audit
- name: cargo audit
if: ${{ inputs.publish_razy_importer }}
uses: gh640/command-result-action@v1
id: cargo_audit_r
with:
command: 'cargo audit'
cwd: './razy-importer'
- name: cargo audit
if: ${{ inputs.publish_razy_importer_macros }}
uses: gh640/command-result-action@v1
id: cargo_audit_rm
with:
command: 'cargo audit'
cwd: './razy-importer-macros'
- name: remove ansi color escape sequences
if: ${{ inputs.publish_razy_importer }}
uses: marcransome/remove-ansi-colors@v1
id: cargo_audit_escaped_r
with:
colored: ${{ steps.cargo_audit_r.outputs.stdout }}
- name: remove ansi color escape sequences
if: ${{ inputs.publish_razy_importer_macros }}
uses: marcransome/remove-ansi-colors@v1
id: cargo_audit_escaped_rm
with:
colored: ${{ steps.cargo_audit_rm.outputs.stdout }}
- name: publish razy-importer
if: ${{ inputs.publish_razy_importer }}
uses: gh640/command-result-action@v1
id: cargo_publish_r
with:
command: 'cargo publish --token ${{ secrets.CRATES_TOKEN }} -p razy-importer'
- name: publish razy-importer
if: ${{ inputs.publish_razy_importer_macros }}
uses: gh640/command-result-action@v1
id: cargo_publish_rm
with:
command: 'cargo publish --token ${{ secrets.CRATES_TOKEN }} -p razy-importer-macros'
- name: remove ansi color escape sequences
if: ${{ inputs.publish_razy_importer }}
uses: marcransome/remove-ansi-colors@v1
id: cargo_publish_escaped_r
with:
colored: ${{ steps.cargo_publish_r.outputs.stdout }}
- name: remove ansi color escape sequences
if: ${{ inputs.publish_razy_importer_macros }}
uses: marcransome/remove-ansi-colors@v1
id: cargo_publish_escaped_rm
with:
colored: ${{ steps.cargo_publish_rm.outputs.stdout }}
- name: lookup release version
if: ${{ inputs.publish_razy_importer }}
id: version_r
uses: thebongy/version-check@v1
with:
file: './razy-importer/Cargo.toml'
tagFormat: 'razy-importer-v${version}'
- name: lookup release version
if: ${{ inputs.publish_razy_importer_macros }}
id: version_rm
uses: thebongy/version-check@v1
with:
file: './razy-importer-macros/Cargo.toml'
tagFormat: 'razy-importer-macros-v${version}'
- name: tag action
if: ${{ inputs.publish_razy_importer }}
id: tag_r
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
custom_tag: '${{ steps.version_r.outputs.releaseVersion }}'
tag_prefix: ''
- name: tag action
if: ${{ inputs.publish_razy_importer_macros }}
id: tag_rm
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
custom_tag: '${{ steps.version_rm.outputs.releaseVersion }}'
tag_prefix: ''
- name: push tag
run: git push origin --tags
- name: generate changelog
id: changelog
uses: requarks/changelog-action@v1
with:
token: '${{ github.token }}'
tag: '${{ steps.version_r.outputs.releaseVersion }}'
writeToFile: false
includeInvalidCommits: true
- name: create release
if: ${{ inputs.publish_razy_importer }}
id: release_r
uses: softprops/action-gh-release@v1
with:
body: |
${{ steps.changelog.outputs.changelog }}
<details>
<summary>Cargo Audit</summary>
```
${{ steps.cargo_audit_escaped_r.outputs.uncolored }}
```
</details>
<details>
<summary>Publish</summary>
```
${{ steps.cargo_publish_r.outputs.stdout }}
```
</details>
tag_name: '${{ steps.version_r.outputs.releaseVersion }}'
draft: false
prerelease: false
- name: create release
if: ${{ inputs.publish_razy_importer_macros }}
id: release_rm
uses: softprops/action-gh-release@v1
with:
body: |
${{ steps.changelog.outputs.changelog }}
<details>
<summary>Cargo Audit</summary>
```
${{ steps.cargo_audit_escaped_rm.outputs.uncolored }}
```
</details>
<details>
<summary>Publish</summary>
```
${{ steps.cargo_publish_rm.outputs.stdout }}
```
</details>
tag_name: '${{ steps.version_rm.outputs.releaseVersion }}'
draft: false
prerelease: false