Skip to content

Commit

Permalink
Merge pull request #15 from RedPillAnalytics/develop
Browse files Browse the repository at this point in the history
Testing push payload for PR.
  • Loading branch information
stewartbryson authored Jan 22, 2021
2 parents 535d0ca + 39473d9 commit 6da8849
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ I've done very little new development here... I'm standing on the shoulders of g
- [GitHub CLI](https://cli.github.com/): For non-Gradle releases, the GitHub CLI can be used instead to publish releases back to GitHub. You can use [our pre-built container](https://github.com/RedPillAnalytics/docker-gh) for dealing with GitHub CLI. This repository is built using this technique, so take a look at [the `cloudbuild.yaml` file](cloudbuild.yaml) as a sample. In this example, we don't actually build tags, but instead tag the image as part of the merge into master.

## cloudbuild.yaml
In our `cloudbuild.yaml` file, we include the `project-version` image as an early step, passing the built-in GCB variables `$REPO_NAME` and `BRANCH_NAME`:
In our `cloudbuild.yaml` file, we include the `project-version` image as an early step, and define a payload substitution that allows us to get the git URL from the event payload. We then pass that substitution, called `$_REPO_URL` along with the built in substitution `BRANCH_NAME`:
```
substitutions:
_REPO_URL: $(body.repository.html_url)
steps:
- name: gcr.io/$PROJECT_ID/project-version
id: version
args:
- $REPO_NAME
- $_REPO_URL
- $BRANCH_NAME
waitFor: ['-']
```
Expand Down
4 changes: 3 additions & 1 deletion cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ substitutions:
# If it's a tag, image tag will be the tag
# If it's not a tag or a PR, then it should be latest
_IMAGE_NAME: ${_REPO_SHORT}:${_TAG_NAME:-latest}
# Get repository URL
_REPO_URL: $(body.repository.html_url)
steps:
- name: gcr.io/$PROJECT_ID/project-version
id: version
args:
- $REPO_NAME
- $REPO_URL
- $BRANCH_NAME
waitFor: ['-']
- name: 'gcr.io/kaniko-project/executor:latest'
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ echo $version > $versionfile
# update the version property
javaproperties set -o props.temp $properties version $version
mv props.temp $properties
echo $tag
echo $version

0 comments on commit 6da8849

Please sign in to comment.