-
Notifications
You must be signed in to change notification settings - Fork 10
176 lines (155 loc) · 5.88 KB
/
release.yaml
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
# ********************************************************************************
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************/
# Create artifacts for project releases
# Note: might also include crates.io publication step, if we're confident about our overall workflow
name: Release
on:
push:
tags:
- v*
workflow_dispatch:
concurrency:
group: "release-${{ github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
check:
uses: ./.github/workflows/check.yaml
coverage:
uses: ./.github/workflows/coverage.yaml
licenses:
# This works off the license declarations in dependent packages/crates, so if these declarations are wrong, this report will contain erroneous information
uses: ./.github/workflows/license-report.yaml
release:
name: collect workflow artifacts
runs-on: ubuntu-latest
needs:
- check
- coverage
- licenses
steps:
- uses: actions/checkout@v4
- name: Upload README
id: upload_readme
uses: actions/upload-artifact@v4
with:
name: readme
path: README.md
- name: Collect quality artifacts
uses: anotherdaniel/[email protected]
id: quevee
with:
release_url: ${{ github.ref_name }}
artifacts_license: ${{ needs.licenses.outputs.license_report_url }}
artifacts_readme: ${{ steps.upload_readme.outputs.artifact-url }}
artifacts_testing: ${{ needs.check.outputs.test_results_url }},${{ needs.coverage.outputs.test_coverage_url }}
- name: Store quality manifest as workflow artifact
uses: actions/upload-artifact@v4
with:
name: quality-artifacts-manifest
path: ${{ steps.quevee.outputs.manifest_file }}
tag_release_artifacts:
# This only runs if this workflow is initiated via a tag-push with pattern 'v*'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: collect v-tag release artifacts
runs-on: ubuntu-latest
needs:
- check
- coverage
- licenses
permissions: write-all
steps:
- uses: actions/checkout@v4
# License report - we later need the download_url output of the upload step
- name: Download license report
uses: actions/download-artifact@v4
with:
name: license-report
path: dist/license/
- name: Upload license report to release
uses: svenstaro/upload-release-action@v2
id: upload_license_report
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/license/*
file_glob: true
tag: ${{ github.ref }}
# Test report - we later need the download_url output of the upload step
- name: Download test report
uses: actions/download-artifact@v4
with:
name: test-results
path: dist/tests/
- name: Upload test report to release
uses: svenstaro/upload-release-action@v2
id: upload_test_report
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/tests/*
file_glob: true
tag: ${{ github.ref }}
# Test coverage - we later need the download_url output of the upload step
- name: Download test coverage
uses: actions/download-artifact@v4
with:
name: code-coverage-html
path: dist/codecov/
- name: Upload test coverage to release
uses: svenstaro/upload-release-action@v2
id: upload_test_coverage
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/codecov/*
file_glob: true
tag: ${{ github.ref }}
# README - we later need the download_url output of the upload step
- name: Upload README to release
uses: svenstaro/upload-release-action@v2
id: upload_readme
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: README.md
tag: ${{ github.ref }}
- name: Gets latest created release info
id: latest_release_info
uses: joutvhu/get-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Collect quality artifacts
uses: anotherdaniel/[email protected]
id: quevee_manifest
with:
release_url: ${{ steps.latest_release_info.outputs.html_url }}
artifacts_license: ${{ steps.upload_license_report.outputs.browser_download_url }}
artifacts_readme: ${{ steps.upload_readme.outputs.browser_download_url }}
artifacts_testing: ${{ steps.upload_test_report.outputs.browser_download_url }},${{ steps.upload_test_coverage.outputs.browser_download_url }}
- name: Upload manifest to release
uses: svenstaro/upload-release-action@v2
id: upload_quality_manifest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.quevee_manifest.outputs.manifest_file }}
tag: ${{ github.ref }}
cargo-publish:
name: publish to crates.io
# This will publish to crates.io if secrets.CRATES_TOKEN is set in the workspace, otherwise do a dry-run
runs-on: ubuntu-latest
needs:
- tag_release_artifacts
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
steps:
- uses: actions/checkout@v4
- if: env.CRATES_TOKEN == ''
run: cargo publish --all-features --dry-run
- if: env.CRATES_TOKEN != ''
run: cargo publish --all-features --token ${CRATES_TOKEN}