Use commit hash to build docker image and publish.

This commit is contained in:
Arijit Das 2021-12-23 19:51:06 +05:30
parent e08d31e242
commit 747c5f5400

View File

@ -9,14 +9,15 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Get the version - 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 id: vars
- name: Extract branch name - name: Docker Login to Docker Registry
shell: bash uses: docker/login-action@v1
run: echo "##[set-output name=branch;]$(echo ${GITHUB_BASE_REF#refs/heads/})" with:
id: extract_branch username: vulcanizejenkins
- name: Docker Login password: ${{ secrets.VULCANIZEJENKINS_PAT }}
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u vulcanize --password-stdin
- name: Build and push - name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
@ -24,4 +25,5 @@ jobs:
push: true push: true
tags: vulcanize/eth-statediff-service:${{ steps.vars.outputs.tag }} tags: vulcanize/eth-statediff-service:${{ steps.vars.outputs.tag }}
build-args: | build-args: |
BRANCH=${{ steps.extract_branch.outputs.branch }} GIT_COMMIT=${{ steps.vars.outputs.sha }}