Skip to content

Commit

Permalink
Merge pull request #2 from arvdias/adias/add-release-workflow
Browse files Browse the repository at this point in the history
adias/add release workflow
  • Loading branch information
arvdias authored Nov 23, 2020
2 parents ea374fa + ff2015c commit 9918c38
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
env:

DOCKER_IMAGE_NAME: newrelic/nri-kube-events
RELEASE_VERSION: ${{ github.event.release.name }}
RELEASE_VERSION: ${{ github.event.release.tag_name }}
S3_PATH: s3://nr-downloads-main/infrastructure_agent

jobs:
Expand All @@ -25,17 +25,13 @@ jobs:
RELEASE_VERSION="$(echo $RELEASE_VERSION | grep -oE '([0-9.]*[0-9])$')"
echo "RELEASE_VERSION=$RELEASE_VERSION">> $GITHUB_ENV
DOCKER_IMAGE_NAME="$DOCKER_IMAGE_NAME:$RELEASE_VERSION"
echo "DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME" >> $GITHUB_ENV
echo "DOCKER_IMAGE_NAME="$DOCKER_IMAGE_NAME:$RELEASE_VERSION" >> $GITHUB_ENV
- name: Test for prerelase
if: "github.event.release.prerelease"
if: ${{ github.event.release.prerelease }}
run: |
DOCKER_IMAGE_NAME="$DOCKER_IMAGE_NAME-pre"
echo "DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME" >> $GITHUB_ENV
S3_PATH="$S3_PATH/test"
echo "S3_PATH=$S3_PATH" >> $GITHUB_ENV
echo "DOCKER_IMAGE_NAME="$DOCKER_IMAGE_NAME-pre" >> $GITHUB_ENV
echo "S3_PATH="$S3_PATH/test" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -44,10 +40,18 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
env:
PRERELEASE: ${{ github.event.release.prerelease }}
run: |
make docker-build
docker push $DOCKER_IMAGE_NAME
# if this is a pre-release do not push 'latest'
if [[ "false" eq "${{ github.event.release.prerelease }}" ]]; then
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest
docker push $DOCKER_IMAGE_NAME:latest
fi
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down

0 comments on commit 9918c38

Please sign in to comment.