This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
🐳 Generate Docker image #5373
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: 🐳 Generate Docker image | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
push: | |
tags: | |
- 'v*' | |
branches: | |
- 'main' | |
workflow_dispatch: | |
schedule: | |
- cron: '12 0 * * *' | |
jobs: | |
build: | |
name: 🐳 Generate Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
env: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
if: ${{env.username != ''}} | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: kaotoio/frontend | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
env: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
if: ${{env.username != ''}} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |