Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/UI-1025_Dfuse-eosio_automated_builds #246

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 30 additions & 42 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,35 @@ on:

jobs:
build:
name: Build and Push image
runs-on: ubuntu-latest

steps:
- 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: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.docker_hub_username }}
password: ${{ secrets.docker_hub_token }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: dfuse/dfuse-eosio

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
build-args: |
VERSION=${{ steps.branch_name.outputs.VERSION }}
COMMIT=${GITHUB_SHA:0:7}
tags: |
dfuse/dfuse-eosio:latest
dfuse/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }}
ghcr.io/dfuse-io/dfuse-eosio:latest
ghcr.io/dfuse-io/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }}
- name: Checkout
uses: actions/checkout@v2

- 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
uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GCR_KEY }}
project_id: dfuse-302310
export_default_credentials: true

- name: Build Image
run: |-
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: |
gcloud auth configure-docker -q

# Push image to Google Container Registry
- name: Push Image
run: |-
docker push eu.gcr.io/dfuse-302310/dfuse-eosio:${{ steps.branch_name.outputs.VERSION }}
docker push eu.gcr.io/dfuse-302310/dfuse-eosio:latest