Skip to content

Commit

Permalink
Update publish workflow for test-log-macros
Browse files Browse the repository at this point in the history
This change updates the publish workflow to accommodate for the recent
introduction of the test-log-macros crate to the workspace. Said crate
needs to be published before test-log itself, because test-log depends
on it. In terms of crate versioning we unconditionally release both
crates in lockstep for the sake of simplicity.
  • Loading branch information
d-e-s-o committed Feb 25, 2024
1 parent 936713a commit b4bd011
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ jobs:
# file://<path>/<crate>#<version>
# but could also be along the lines of
# file://<path>/<crate>#<actual-crate-name>@<version>
version="$(echo ${pkgid} | cut -d '#' -f2 | cut -d '@' -f2 | grep -o '[^:]*$')"
version="$(echo ${pkgid} | cut -d '#' -f2 | cut -d '@' -f2 | grep -o '[^:]*$')"
macros_version="$(cd macros && cargo pkgid | cut -d '#' -f2 | cut -d '@' -f2 | grep -o '[^:]*$')"
if [ -z "${version}" ]; then
echo "Invalid version string: ${pkgid}"
exit 1
fi
if [ "${version}" != "${macros_version}" ]; then
echo "test-log and test-log-macros have differing version (${version} vs. ${macros_version}"
exit 1
fi
echo "Determined crate version: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
test:
Expand All @@ -40,7 +46,9 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Dry-run package creation
run: cargo package --no-verify
# Can't verify test-log for it may depend on yet-to-be-published
# test-log-macros.
run: cargo package --package macros --workspace --exclude test-log
- name: Create git tag
env:
version: ${{ needs.version.outputs.version }}
Expand All @@ -59,7 +67,11 @@ jobs:
\"prerelease\":false,
\"generate_release_notes\":false
}"
- name: Publish
- name: Publish test-log-macros
run: cd macros/ && cargo publish --no-verify --token "${CARGO_REGISTRY_TOKEN}"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish test-log
run: cargo publish --no-verify --token "${CARGO_REGISTRY_TOKEN}"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit b4bd011

Please sign in to comment.