Add docker build and push to docker hub

This commit is contained in:
Mark Sagi-Kazar 2020-07-01 13:03:41 +02:00
parent eef8c0a60d
commit 0b067af8e7
No known key found for this signature in database
GPG key ID: 34CC109EB5ED1C2A
2 changed files with 50 additions and 0 deletions

View file

@ -81,3 +81,29 @@ jobs:
# Ensure proto generation doesn't depend on external packages. # Ensure proto generation doesn't depend on external packages.
- name: Verify proto - name: Verify proto
run: make verify-proto run: make verify-proto
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Determine tag
uses: haya14busa/action-cond@v1
id: imagetag
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.sha }}
if_false: "master"
- name: Build
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: dexidp/dex
tags: ${{ steps.imagetag.outputs.value }}
add_git_labels: true
push: ${{ github.event_name == 'push' }}

24
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push image
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: dexidp/dex
tags: latest
tag_with_ref: true
add_git_labels: true