Skip to content

Commit

Permalink
.github/workflows: fix registry version check comparison (hashicorp#4…
Browse files Browse the repository at this point in the history
…0406)

The version returned from the `curl` request to the registry will contain only the version number, while the release tag is prefixed with `v`.

For example, here is what is stored in the `LATEST_VERSION` environment
variable:

```console
% curl -s "https://registry.terraform.io/v2/providers/323/provider-versions/latest" | jq -r '.data.attributes.version'
5.79.0
```

This changes the conditional to apply a prefix to the version number fetched from the registry to allow an accurate comparison of the two values.
  • Loading branch information
jar-b authored Dec 3, 2024
1 parent 88644d2 commit 6e0dff3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/post_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
for i in 1 2
do
LATEST_VERSION=$(curl -s "https://registry.terraform.io/v2/providers/323/provider-versions/latest" | jq -r '.data.attributes.version')
if [[ "${{ needs.on-success-or-workflow-dispatch.outputs.release-tag }}" != ${LATEST_VERSION} ]]; then
if [[ "${{ needs.on-success-or-workflow-dispatch.outputs.release-tag }}" != "v${LATEST_VERSION}" ]]; then
sleep 1h
else
echo "Registry and Github Version matches"
Expand Down

0 comments on commit 6e0dff3

Please sign in to comment.