Skip to content

Commit

Permalink
Merge pull request #11 from HENNGE/bugfix/latest-release
Browse files Browse the repository at this point in the history
Fix a logic to get the latest release version
  • Loading branch information
sharu1204 authored Apr 28, 2021
2 parents 0905a6b + 6969df1 commit 2b91887
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,20 @@ jobs:
- uses: actions/checkout@v2

- name: Update terraform
uses: HENNGE/tfupdate-action@v0.1.1
uses: HENNGE/tfupdate-action@v1.0.0
with:
resource: "terraform"
file_path: "./tf/config.tf"

- name: Update terraform provider
uses: HENNGE/tfupdate-action@v0.1.1
uses: HENNGE/tfupdate-action@v1.0.0
with:
resource: "provider"
provider_name: "aws"
file_path: "./tf/config.tf"

- name: Update terraform module
uses: HENNGE/tfupdate-action@v0.1.1
uses: HENNGE/tfupdate-action@v1.0.0
with:
resource: "module"
module_name: "terraform-aws-modules/vpc/aws"
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -e
function run_tfupdate {
case ${INPUT_RESOURCE} in
terraform)
VERSION=$(tfupdate release latest hashicorp/terraform)
VERSION=$(tfupdate release list hashicorp/terraform| grep -v ".*-rc[0-9]$"| sort -r| head -1)
PULL_REQUEST_BODY="For details see: https://github.com/hashicorp/terraform/releases"
UPDATE_MESSAGE="[tfupdate] Bump Terraform to v${VERSION}"
;;
Expand All @@ -19,7 +19,7 @@ function run_tfupdate {
echo 'ERROR: "provier_name" needs to be set for "provider" resource'
exit 1
fi
VERSION=$(tfupdate release latest terraform-providers/terraform-provider-${INPUT_PROVIDER_NAME})
VERSION=$(tfupdate release list terraform-providers/terraform-provider-${INPUT_PROVIDER_NAME}| grep -v ".*-rc[0-9]$"| sort -r| head -1)
PULL_REQUEST_BODY="For details see: https://github.com/terraform-providers/terraform-provider-${INPUT_PROVIDER_NAME}/releases"
UPDATE_MESSAGE="[tfupdate] Bump Terraform Provider to v${VERSION}"
;;
Expand All @@ -28,7 +28,7 @@ function run_tfupdate {
echo 'ERROR: both "module_name" and "source_type" need to be set for "module" resource'
exit 1
fi
VERSION=$(tfupdate release latest --source-type=${INPUT_SOURCE_TYPE} ${INPUT_MODULE_NAME})
VERSION=$(tfupdate release list --source-type=${INPUT_SOURCE_TYPE} ${INPUT_MODULE_NAME}| grep -v ".*-rc[0-9]$"| sort -r| head -1)
UPDATE_MESSAGE="[tfupdate] Bump Terraform Module ${INPUT_MODULE_NAME} to v${VERSION}"
case ${INPUT_SOURCE_TYPE} in
github)
Expand Down

0 comments on commit 2b91887

Please sign in to comment.