diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e39669b..22a4db1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }}