Skip to content

Commit 08b383f

Browse files
committed
Version 1.1.2
Simplify publish workflow
1 parent 3fb19ad commit 08b383f

3 files changed

Lines changed: 14 additions & 30 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,30 @@ name: publish-to-crates-io
33
on:
44
push:
55
tags:
6-
- "v*.*.*"
6+
- v[0-9]+.[0-9]+.[0-9]+
77

88
permissions:
99
contents: read
1010

1111
jobs:
1212
publish:
1313
runs-on: ubuntu-latest
14+
container:
15+
image: rust:latest
1416
steps:
15-
- uses: actions/checkout@v4
16-
- uses: dtolnay/rust-toolchain@stable
17-
- uses: Swatinem/rust-cache@v2
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
1819

19-
- name: Verify tag matches Cargo.toml version
20-
run: |
21-
set -euo pipefail
22-
TAG="${GITHUB_REF_NAME#v}"
23-
VER=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
24-
test "$TAG" = "$VER" || { echo "Tag v$TAG does not match Cargo.toml $VER"; exit 1; }
20+
- name: Install toml-cli
21+
run: cargo install toml-cli
2522

26-
- name: Skip if version already on crates.io
27-
id: exists
28-
run: |
29-
set -euo pipefail
30-
NAME=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].name')
31-
VER=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
32-
MAX=$(curl -sSf "https://crates.io/api/v1/crates/$NAME" | jq -r '.crate.max_version')
33-
if [ "$MAX" = "$VER" ]; then
34-
echo "skip=true" >> "$GITHUB_OUTPUT"
35-
echo "version $VER already on crates.io"
36-
else
37-
echo "skip=false" >> "$GITHUB_OUTPUT"
38-
fi
23+
- name: Check version
24+
run: test "v$(toml get -r Cargo.toml package.version)" = "${{ github.ref_name }}"
3925

40-
- name: Package dry run
41-
if: steps.exists.outputs.skip == 'false'
26+
- name: Publish dry-run
4227
run: cargo publish --dry-run
4328

4429
- name: Publish
45-
if: steps.exists.outputs.skip == 'false' && env.ACT != 'true'
4630
env:
47-
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
31+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
4832
run: cargo publish

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "markcat"
3-
version = "1.1.1"
3+
version = "1.1.2"
44
edition = "2021"
5-
author = "Ted Pinkerton"
5+
authors = ["Ted Pinkerton"]
66
license = "MIT"
77
description = "Convert a project directory to markdown"
88
homepage = "https://github.com/RunnersNum40/markcat"

0 commit comments

Comments
 (0)