From 747c5f540050f4e47d334e0ab7ccf2c1ac0f5c9f Mon Sep 17 00:00:00 2001 From: Arijit Das Date: Thu, 23 Dec 2021 19:51:06 +0530 Subject: [PATCH] Use commit hash to build docker image and publish. --- .github/workflows/publish.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f017698..c673a8c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,14 +9,15 @@ jobs: steps: - uses: actions/checkout@v2 - name: Get the version - run: echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) + run: | + echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) + echo ::set-output name=sha::$(echo ${GITHUB_SHA}) id: vars - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_BASE_REF#refs/heads/})" - id: extract_branch - - name: Docker Login - run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin + - name: Docker Login to Docker Registry + uses: docker/login-action@v1 + with: + username: vulcanizejenkins + password: ${{ secrets.VULCANIZEJENKINS_PAT }} - name: Build and push uses: docker/build-push-action@v2 with: @@ -24,4 +25,5 @@ jobs: push: true tags: vulcanize/eth-statediff-service:${{ steps.vars.outputs.tag }} build-args: | - BRANCH=${{ steps.extract_branch.outputs.branch }} + GIT_COMMIT=${{ steps.vars.outputs.sha }} +