Skip to content

Commit d0cfe20

Browse files
Merge #827
827: Improve release infrastructure r=Alexhuszagh a=Emilgardis Co-authored-by: Emil Gardström <[email protected]>
2 parents d0729f5 + a06c16b commit d0cfe20

File tree

5 files changed

+74
-12
lines changed

5 files changed

+74
-12
lines changed

.github/actions/cargo-publish/action.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
cargo-registry-token:
55
description: 'API token for crates.io'
66
required: true
7+
github-token:
8+
description: 'Github API token'
9+
required: true
710

811
runs:
912
using: composite
@@ -13,7 +16,7 @@ runs:
1316
uses: mindsers/[email protected]
1417
with:
1518
# validation_depth: 10
16-
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}
19+
version: ${{ (github.ref_type == 'tag' && !contains(github.ref_name, '-') && github.ref_name) || 'Unreleased' }}
1720
path: ./CHANGELOG.md
1821

1922
- name: Download artifacts
@@ -30,6 +33,14 @@ runs:
3033
command: login
3134
args: -- ${{ inputs.cargo-registry-token }}
3235

36+
- run: gh release delete --yes Unreleased || exit 0
37+
if: >
38+
github.event_name == 'push' &&
39+
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
40+
shell: bash
41+
env:
42+
GITHUB_TOKEN: ${{ inputs.github-token }}
43+
3344
- name: Create GitHub release
3445
if: >
3546
github.event_name == 'push' && (
@@ -38,10 +49,10 @@ runs:
3849
)
3950
uses: softprops/action-gh-release@v1
4051
with:
41-
tag_name: ${{ steps.changelog-reader.outputs.version }}
52+
tag_name: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}
4253
body: ${{ steps.changelog-reader.outputs.changes }}
43-
prerelease: ${{ steps.changelog-reader.outputs.status == 'prereleased' }}
44-
draft: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
54+
prerelease: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref_name, '-') }}
55+
draft: ${{ !startsWith(github.ref, 'refs/tags/v') && steps.changelog-reader.outputs.status == 'unreleased' }}
4556
files: |
4657
${{ steps.download-artifacts.outputs.download-path }}/*/*
4758

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ jobs:
301301
- uses: ./.github/actions/cargo-publish
302302
with:
303303
cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
304+
github-token: ${{ secrets.GITHUB_TOKEN }}
304305

305306
conclusion:
306307
needs: [shellcheck, fmt, clippy, test, generate-matrix, build, publish]

CHANGELOG.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6-
## [Unreleased]
6+
<!-- next-header -->
7+
8+
## [Unreleased] - ReleaseDate
79

810
### Added
911

@@ -65,7 +67,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
6567
- #665 - when not using [env.volumes](https://github.com/cross-rs/cross#mounting-volumes-into-the-build-environment), mount project in /project
6668
- #494 - Parse Cargo's --manifest-path option to determine mounted docker root
6769

68-
6970
### Removed
7071

7172
- #718 - remove deb subcommand.
@@ -143,8 +144,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
143144

144145
[`deb`]: https://github.com/mmstick/cargo-deb
145146

146-
- Partial `test` / `run` support for android targets. Using the android API via `cross run` / `cross
147-
test` is *not* supported because Cross is using QEMU instead of the official Android emulator.
147+
- Partial `test` / `run` support for android targets. Using the android API via `cross run` / `cross test` is _not_ supported because Cross is using QEMU instead of the official Android emulator.
148148

149149
- Partial support for the `sparcv9-sun-solaris` and `x86_64-sun-solaris` targets. `cross test` and
150150
`cross run` doesn't work for these new targets.
@@ -165,7 +165,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
165165

166166
- `binfmt_misc` is not required on the host for toolchain v1.19.0 and newer.
167167
With these toolchains `binfmt_misc` interpreters don't need to be installed
168-
on the host saving a *privileged* docker run which some systems don't allow.
168+
on the host saving a _privileged_ docker run which some systems don't allow.
169169

170170
## [v0.1.11] - 2017-06-10
171171

@@ -262,9 +262,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
262262

263263
- Building older versions (<0.7.0) of the `openssl` crate is now supported.
264264

265-
- Before Docker is invoked, `cross` will *always* (re)generate the lockfile to
265+
- Before Docker is invoked, `cross` will _always_ (re)generate the lockfile to
266266
avoid errors later on due to read/write permissions. This removes the need to
267-
call `cargo generate-lockfile` before `cross` in *all* cases.
267+
call `cargo generate-lockfile` before `cross` in _all_ cases.
268268

269269
## [v0.1.4] - 2017-01-07
270270

@@ -315,6 +315,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
315315

316316
- Initial release. Supports 12 targets.
317317

318+
<!-- prettier-ignore-start -->
319+
<!-- next-url -->
320+
318321
[Unreleased]: https://github.com/cross-rs/cross/compare/v0.2.1...HEAD
319322
[v0.2.1]: https://github.com/cross-rs/cross/compare/v0.2.0...v0.2.1
320323
[v0.2.0]: https://github.com/cross-rs/cross/compare/v0.1.16...v0.2.0
@@ -334,3 +337,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
334337
[v0.1.3]: https://github.com/cross-rs/cross/compare/v0.1.2...v0.1.3
335338
[v0.1.2]: https://github.com/cross-rs/cross/compare/v0.1.1...v0.1.2
336339
[v0.1.1]: https://github.com/cross-rs/cross/compare/v0.1.0...v0.1.1
340+
<!-- prettier-ignore-end -->

Cargo.toml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
build = "build.rs"
2+
build = "src/build.rs"
33
description = "Zero setup cross compilation and cross testing"
44
documentation = "https://github.com/cross-rs/cross"
55
keywords = ["cross", "compilation", "testing", "tool"]
@@ -8,6 +8,17 @@ name = "cross"
88
repository = "https://github.com/cross-rs/cross"
99
version = "0.2.1"
1010
edition = "2021"
11+
include = [
12+
"src/**/*",
13+
"docker/Dockerfile.*",
14+
"docker/*.sh",
15+
"docs/*.md",
16+
"Cargo.toml",
17+
"Cargo.lock",
18+
"LICENSE*",
19+
"README.md",
20+
"assets/*",
21+
]
1122

1223
[features]
1324
default = []
@@ -48,3 +59,38 @@ lto = true
4859
regex = "1"
4960
once_cell = "1"
5061
walkdir = "2"
62+
63+
[package.metadata.release]
64+
dev-version = false
65+
push = false
66+
publish = false
67+
tag = false
68+
pre-release-commit-message = "release version {{version}}"
69+
70+
[[package.metadata.release.pre-release-replacements]]
71+
file = "CHANGELOG.md"
72+
search = "Unreleased"
73+
replace = "v{{version}}"
74+
75+
[[package.metadata.release.pre-release-replacements]]
76+
file = "CHANGELOG.md"
77+
search = "\\.\\.\\.HEAD"
78+
replace = "...{{tag_name}}"
79+
exactly = 1
80+
81+
[[package.metadata.release.pre-release-replacements]]
82+
file = "CHANGELOG.md"
83+
search = "ReleaseDate"
84+
replace = "{{date}}"
85+
86+
[[package.metadata.release.pre-release-replacements]]
87+
file = "CHANGELOG.md"
88+
search = "<!-- next-header -->"
89+
replace = "<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
90+
exactly = 1
91+
92+
[[package.metadata.release.pre-release-replacements]]
93+
file = "CHANGELOG.md"
94+
search = "<!-- next-url -->"
95+
replace = "<!-- next-url -->\n\n[Unreleased]: https://github.com/cross-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
96+
exactly = 1

build.rs renamed to src/build.rs

File renamed without changes.

0 commit comments

Comments
 (0)