الملفات
github-actions-demos/.github/workflows/docker-image.yml
2023-10-02 00:18:20 +00:00

40 أسطر
879 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@v3
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 }}