Merge pull request #16 from up9inc/feature/try_guthub_action

Add github action to push new image to gcr
This commit is contained in:
Alex Haiut 2021-04-29 14:44:17 +03:00 committed by GitHub
commit 2c5cd39cec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

38
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: ci
on:
push:
branches:
- 'develop'
- 'main'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get base image name
shell: bash
run: echo "##[set-output name=image;]$(echo gcr.io/up9-docker-hub/mizu/${GITHUB_REF#refs/heads/})"
id: base_image_step
- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: ${{ steps.base_image_step.outputs.image }}
tags: |
type=sha
type=raw,${{ github.sha }}
type=raw,latest
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}