fix #1213 adding a class #366
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker image and push to Dockerhub | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: stringerrss/stringer | |
jobs: | |
build_docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract Docker sha tag | |
id: get-tag-sha | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
tags: type=sha | |
- name: Extract Docker latest tag | |
id: get-tag-latest | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
tags: type=raw, value=latest | |
- name: Log in to Docker Hub | |
if: ${{ github.ref_name == 'main' }} | |
id: login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and Push | |
id: build-and-push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.ref_name == 'main' }} | |
tags: | | |
${{ steps.get-tag-latest.outputs.tags }} | |
${{ steps.get-tag-sha.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha |