From 0f3ce2251a16a0d17b637685443795e7590c3d23 Mon Sep 17 00:00:00 2001 From: Alexander Slododaniuk Date: Tue, 14 Sep 2021 14:28:34 +0200 Subject: [PATCH 1/3] UI-1025 Add GCR build and push --- .github/workflows/dockerimage.yml | 41 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index d1c0b83f..ea413495 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -10,25 +10,36 @@ on: jobs: build: + name: Build image runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 - - name: Branch name - id: branch_name - run: | - echo ::set-output name=VERSION::$([[ $GITHUB_REF =~ "refs/tags" ]] && echo ${GITHUB_REF#refs/tags/} || echo "${GITHUB_SHA:0:7}") + - name: Branch name + id: branch_name + run: | + echo ::set-output name=VERSION::$([[ $GITHUB_REF =~ "refs/tags" ]] && echo ${GITHUB_REF#refs/tags/} || echo "${GITHUB_SHA:0:7}") - - name: Build the Docker image - run: | - echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u USERNAME --password-stdin + # Setup gcloud CLI + - uses: google-github-actions/setup-gcloud@master + with: + service_account_key: ${{ secrets.GCR_KEY }} + project_id: dfuse-302310 + export_default_credentials: true - docker build . -t docker.pkg.github.com/dfuse-io/dfuse-eosio/dfuse-eosio:latest -t docker.pkg.github.com/dfuse-io/dfuse-eosio/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} - docker push docker.pkg.github.com/dfuse-io/dfuse-eosio/dfuse-eosio:latest + # Build docker image + - name: Image + run: |- + docker build . -t eu.gcr.io/dfuse-302310/test_dfuse-eosio:latest -t eu.gcr.io/dfuse-302310/test_dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} - echo ${{ secrets.docker_hub_token }} | docker login -u ${{ secrets.docker_hub_username }} --password-stdin - docker image tag docker.pkg.github.com/dfuse-io/dfuse-eosio/dfuse-eosio:latest dfuse/dfuse-eosio:latest - docker image tag docker.pkg.github.com/dfuse-io/dfuse-eosio/dfuse-eosio:latest dfuse/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} + # Configure docker to use the gcloud command-line tool as a credential helper + - run: | + gcloud auth configure-docker -q - docker push dfuse/dfuse-eosio:latest - docker push dfuse/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} + # Push image to Google Container Registry + - name: Build + run: |- + docker push eu.gcr.io/dfuse-302310/test_dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} + docker push eu.gcr.io/dfuse-302310/test_dfuse-eosio:latest From 6f5c660337ce68cb8d2c6d21a7ebefc63dee555c Mon Sep 17 00:00:00 2001 From: Alexander Slododaniuk Date: Tue, 14 Sep 2021 14:50:04 +0200 Subject: [PATCH 2/3] Refactor GH pipeline --- .github/workflows/dockerimage.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index ea413495..97ffebbd 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -10,7 +10,7 @@ on: jobs: build: - name: Build image + name: Build and Push image runs-on: ubuntu-latest steps: @@ -22,24 +22,23 @@ jobs: run: | echo ::set-output name=VERSION::$([[ $GITHUB_REF =~ "refs/tags" ]] && echo ${GITHUB_REF#refs/tags/} || echo "${GITHUB_SHA:0:7}") - # Setup gcloud CLI - - uses: google-github-actions/setup-gcloud@master + - name: Setup Gcloud CLI + uses: google-github-actions/setup-gcloud@master with: service_account_key: ${{ secrets.GCR_KEY }} project_id: dfuse-302310 export_default_credentials: true - # Build docker image - - name: Image + - name: Build Image run: |- docker build . -t eu.gcr.io/dfuse-302310/test_dfuse-eosio:latest -t eu.gcr.io/dfuse-302310/test_dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} - # Configure docker to use the gcloud command-line tool as a credential helper - - run: | + - name: Docker config + run: | gcloud auth configure-docker -q # Push image to Google Container Registry - - name: Build + - name: Push Image run: |- docker push eu.gcr.io/dfuse-302310/test_dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} docker push eu.gcr.io/dfuse-302310/test_dfuse-eosio:latest From 497d38ca9f3c80dcedba0808fcf2f4aa1da1b81a Mon Sep 17 00:00:00 2001 From: Alexander Slododaniuk Date: Tue, 14 Sep 2021 15:09:30 +0200 Subject: [PATCH 3/3] UI-1025 Add GCR build and push --- .github/workflows/dockerimage.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 97ffebbd..0b8e7282 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -17,12 +17,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Branch name + - name: Get branch name id: branch_name run: | echo ::set-output name=VERSION::$([[ $GITHUB_REF =~ "refs/tags" ]] && echo ${GITHUB_REF#refs/tags/} || echo "${GITHUB_SHA:0:7}") - - name: Setup Gcloud CLI + - name: Setup gcloud cli uses: google-github-actions/setup-gcloud@master with: service_account_key: ${{ secrets.GCR_KEY }} @@ -31,7 +31,7 @@ jobs: - name: Build Image run: |- - docker build . -t eu.gcr.io/dfuse-302310/test_dfuse-eosio:latest -t eu.gcr.io/dfuse-302310/test_dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} + docker build . -t eu.gcr.io/dfuse-302310/dfuse-eosio:latest -t eu.gcr.io/dfuse-302310/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} - name: Docker config run: | @@ -40,5 +40,5 @@ jobs: # Push image to Google Container Registry - name: Push Image run: |- - docker push eu.gcr.io/dfuse-302310/test_dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} - docker push eu.gcr.io/dfuse-302310/test_dfuse-eosio:latest + docker push eu.gcr.io/dfuse-302310/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }} + docker push eu.gcr.io/dfuse-302310/dfuse-eosio:latest