الملفات
github-actions-demos/.github/workflows/docker-image.yml
2023-10-01 18:30:26 -04:00

39 أسطر
832 B
YAML

name: Docker Image CI
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'container-example/**'
pull_request:
branches: [ main ]
paths:
- 'container-example/**'
defaults:
run:
working-directory: containers-example
jobs:
build:
environment: docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: container-example
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/static-site:latest
${{ secrets.DOCKER_USERNAME }}/static-site:${{ github.sha }}