Skip to content

Commit ae7acb4

Browse files
committed
Check version format before publishing
1 parent 2c801ba commit ae7acb4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.github/workflows/publish.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ jobs:
2020
- name: Publish and tag
2121
run: |
2222
echo "Current git commit is $(git rev-list -n 1 HEAD)."
23+
2324
VERSION="$(yq '.package.version' Cargo.toml)"
2425
echo "Project version from Cargo.toml is $VERSION"
25-
VERSION_TAG="v$VERSION"
26+
if ! (echo "$VERSION" | grep --quiet "^[0-9]\{1,2\}\.[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\?$"); then
27+
echo "The version format does not look like a release version, not publishing the crate."
28+
exit 1
29+
fi
2630
31+
VERSION_TAG="v$VERSION"
2732
if git tag | grep --quiet "^$VERSION_TAG$"; then
2833
echo "Tag $VERSION_TAG already exists at $(git rev-list -n 1 $VERSION_TAG), not publishing the crate."
2934
exit 1

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ For example spelling/grammar or fixing up a PR by someone else.
154154
## Release Procedure
155155

156156
The project is built automatically by a GitHub action when a new revision is pushed to the master branch.
157-
The crate is published by triggering `.github/workflows/manual.yml` GitHub action.
158-
After the crate is successfully published a new git tag is created in the repository.
157+
The crate is published by triggering `.github/workflows/publish.yml` GitHub action.
158+
After the crate is successfully published a new version's git tag is created in the repository.
159159

160160
So to publish a new version
161161
1. Update `project.version` field in `Cargo.toml`.
162162
2. Push the changes to the `master` branch.
163163
3. Wait until GitHub build job completes successfully.
164-
4. [On the Actions page](https://github.com/RustAudio/rodio/actions) start `.github/workflows/manual.yml`.
164+
4. [On the Actions page](https://github.com/RustAudio/rodio/actions) start `.github/workflows/publish.yml`.

0 commit comments

Comments
 (0)