Skip to content

Commit

Permalink
ci: Fix tag name when published from UI
Browse files Browse the repository at this point in the history
Signed-off-by: Siddharth Chandrasekaran <[email protected]>
  • Loading branch information
sidcha committed Mar 9, 2024
1 parent 5bc567e commit 3767420
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/publish-crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- 'osdpctl-v*'
workflow_dispatch:
inputs:
tags:
tag:
description: 'Tag'
required: true

Expand All @@ -30,7 +30,18 @@ jobs:
with:
toolchain: stable
override: true
- run: cargo publish --token ${CRATES_TOKEN} -p $(echo ${REL_TAG} | perl -pe 's/([a-z\-]+)-v.*/\1/')
- name: "Setup environment - trigger"
if: github.ref == 'refs/heads/master'
run: echo "TAG=${TRIGGER_TAG}" >> "${GITHUB_ENV}"
env:
TRIGGER_TAG: ${{ github.event.inputs.tag }}
- name: "Setup environment - tag"
if: github.ref != 'refs/heads/master'
run: echo "TAG=${REL_TAG}" >> "${GITHUB_ENV}"
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
REL_TAG: ${{ github.ref_name }}
- name: "Publish crate"
run: |
cargo publish --token ${CRATES_TOKEN} -p $(echo ${TAG} | perl -pe 's/([a-z\-]+)-v.*/\1/')
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit 3767420

Please sign in to comment.