Skip to content

Commit

Permalink
Merge pull request #8 from ContainerSolutions/upgrade-docker-build-pu…
Browse files Browse the repository at this point in the history
…sh-action

Upgrade docker image publish actions to use docker/build-push-action@v2
  • Loading branch information
Grzegorz authored Nov 17, 2021
2 parents f7ad93b + 1eb5b87 commit ff335d5
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,38 @@ jobs:
run: |
make coverage
publish:
publish_image:
needs: [build]
name: Publish docker image
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/master')
steps:
- uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/master')
- name: Checkout
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
containersol/prom-metrics-check
tags: |
type=ref,event=push tag
type=semver,pattern={{version}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build and push
uses: docker/build-push-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: containersol/prom-metrics-check
tag_with_ref: true
tag_with_sha: true
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit ff335d5

Please sign in to comment.