Skip to content

Commit

Permalink
update publish script and tag format to better handle package name
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Dec 11, 2023
1 parent 81ea3f8 commit 5a37109
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish to Crates.io
on:
push:
tags:
- '*-v*.*.*' # Match tags like 'package1-v1.2.3'
- '*@*.*.*' # Match tags like 'package1@1.2.3'
workflow_dispatch: # Allow manual workflow dispatch

jobs:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
run: |
# Extract package name from the tag name
TAG_NAME="${{ github.ref }}"
PACKAGE_NAME=$(echo "$TAG_NAME" | cut -d'/' -f3 | cut -d'-' -f1)
PACKAGE_NAME=$(echo "$TAG_NAME" | cut -d'/' -f3 | cut -d'@' -f1)
PACKAGE_NAMES=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[].name' | tr '\n' ' ')
Expand All @@ -82,7 +82,7 @@ jobs:
id: check-version
run: |
PACKAGE_NAME="${{ steps.determine-package.outputs.package }}"
TAG_VERSION=$(echo "${{ github.ref }}" | rev | cut -d 'v' -f 1 | rev)
TAG_VERSION=$(echo "${{ github.ref }}" | cut -d'@' -f2)
MANIFEST_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r --arg PACKAGE_NAME "$PACKAGE_NAME" '.packages[] | select(.name == $PACKAGE_NAME) | .version')
if [ "$TAG_VERSION" != "$MANIFEST_VERSION" ]; then
Expand Down

0 comments on commit 5a37109

Please sign in to comment.