Skip to content

Commit

Permalink
Merge pull request #11 from jfrog/support-prerelease-semver
Browse files Browse the repository at this point in the history
Support prerelease semver in make file
  • Loading branch information
alexhung authored Jan 4, 2022
2 parents b2fa6e0 + d5e8f65 commit cf6e939
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TEST?=./...
TARGET_ARCH?=darwin_amd64
PKG_NAME=pkg/projects
PKG_VERSION_PATH=github.com/jfrog/terraform-provider-project/${PKG_NAME}
VERSION := $(shell git tag --sort=-creatordate | head -1 | sed -n 's/v\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1.\2.\3/p')
VERSION := $(shell git tag --sort=-creatordate | head -1 | sed -n 's/v\([0-9]*\).\([0-9]*\).\([0-9]*\)\(?:.*\)/\1.\2.\3/p')
NEXT_VERSION := $(shell echo ${VERSION}| awk -F '.' '{print $$1 "." $$2 "." $$3 +1 }' )
BINARY_NAME=terraform-provider-project
BUILD_PATH=terraform.d/plugins/registry.terraform.io/jfrog/project/${NEXT_VERSION}/${TARGET_ARCH}
Expand All @@ -14,7 +14,7 @@ install:
(test -f ${BINARY_NAME} || go build -o ./${BINARY_NAME} -ldflags="-X '${PKG_VERSION_PATH}.Version=${NEXT_VERSION}'") && \
mv ${BINARY_NAME} ${BUILD_PATH} && \
rm -f .terraform.lock.hcl && \
sed -ie 's/version = ".*"/version = "${NEXT_VERSION}"/' sample.tf && \
sed -i 's/version = ".*"/version = "${NEXT_VERSION}"/' sample.tf && \
terraform init

clean:
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,33 @@ Requirements:
- [Terraform](https://www.terraform.io/downloads.html) 0.13
- [Go](https://golang.org/doc/install) 1.15+ (to build the provider plugin)

### Building on macOS

This provider uses [GNU sed](https://www.gnu.org/software/sed/) as part of the build toolchain, in both Linux and macOS. This provides consistency across OSes.

If you are building this on macOS, you have two options:
- Install [gnu-sed using brew](https://formulae.brew.sh/formula/gnu-sed), OR
- Use a Linux Docker image/container

#### Using gnu-sed

After installing with brew, get the GNU sed information:

```sh
$ brew info gnu-sed
```

You should see something like:
```
GNU "sed" has been installed as "gsed".
If you need to use it as "sed", you can add a "gnubin" directory
to your PATH from your bashrc like:
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
```

Add the `gnubin` directory to your `.bashrc` or `.zshrc` per instruction so that `sed` command uses gnu-sed.

## Testing

How to run the tests isn't obvious.
Expand Down

0 comments on commit cf6e939

Please sign in to comment.