Skip to content

Commit efa1c7e

Browse files
authored
Merge pull request #58 from auyer/fix-existing-tag-detection-in-workflow
CI: Fix existing tag detection in workflow
2 parents 7759694 + 57645bf commit efa1c7e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/publish.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ jobs:
4545
env:
4646
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4747
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
48+
shell: bash
4849
run: |
50+
set -o pipefail
4951
# retrieve available versions in crates.io api to skip upload if it was published already
50-
published_versions=$( curl 'https://crates.io/api/v1/crates/libprotonup' -H 'Accept: */*' | jq -r '.versions[].num' )
52+
published_versions=$( curl -s --fail -A "github.com/auyer/Protonup-rs curl release workflow" 'https://crates.io/api/v1/crates/libprotonup' -H 'Accept: */*' | jq '.versions[].num' )
5153
exists=false
54+
echo "known versions:"
55+
echo $published_versions
5256
for version in $published_versions; do
53-
if [[ "$version" == "$CURRENT_VERSION" ]]; then
57+
if [[ "$version" =~ "$CURRENT_VERSION" ]]; then
5458
exists=true
5559
break
5660
fi
@@ -105,12 +109,16 @@ jobs:
105109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106110
# This can help you publish to crates.io
107111
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
112+
shell: bash
108113
run: |
114+
set -o pipefail
109115
# retrieve available versions in crates.io api to skip upload if it was published already
110-
published_versions=$( curl 'https://crates.io/api/v1/crates/Protonup-rs' -H 'Accept: */*' | jq -r '.versions[].num' )
116+
published_versions=$( curl -s --fail -A "github.com/auyer/Protonup-rs curl release workflow" 'https://crates.io/api/v1/crates/Protonup-rs' -H 'Accept: */*' | jq '.versions[].num' )
111117
exists=false
118+
echo "known versions:"
119+
echo $published_versions
112120
for version in $published_versions; do
113-
if [[ "$version" == "$CURRENT_VERSION" ]]; then
121+
if [[ "$version" =~ "$CURRENT_VERSION" ]]; then
114122
exists=true
115123
break
116124
fi

0 commit comments

Comments
 (0)