Skip to content

Commit

Permalink
Merge pull request #4 from hazelops/feature/update-github-workflow
Browse files Browse the repository at this point in the history
Update workflow CORE-181
  • Loading branch information
kobrikx authored Oct 15, 2021
2 parents ee4fcbb + 64a19a3 commit 403f215
Showing 1 changed file with 54 additions and 16 deletions.
70 changes: 54 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,57 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Image
run: |
docker build -t $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:latest .
- name: Push
run: |
docker push $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME:latest
- name: Check Out Repo
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:latest

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} > digest.txt

- uses: actions/upload-artifact@v1
with:
name: digest
path: ./digest.txt

- name: Get Time
id: time
uses: nanzm/get-time-action@v1.1
with:
timeZone: 0
format: 'YYYY-MM-DD'

- name: Bump version and push tag
id: tag_version
uses: anothrNick/github-tag-action@1.36.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
INITIAL_VERSION: 0.0.0
RELEASE_BRANCHES: develop

- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }} on ${{ steps.time.outputs.time }}
artifacts: "digest.txt"
body: |
Docker image digest: ${{ steps.docker_build.outputs.digest }}

0 comments on commit 403f215

Please sign in to comment.