-
Notifications
You must be signed in to change notification settings - Fork 3
44 lines (37 loc) · 1.14 KB
/
docker-hub-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
# Publish Docker Image to Docker Hub
name: Docker Hub Deployment
on:
push:
branches:
- main
jobs:
docker_build:
runs-on: ubuntu-latest
env:
IMAGE_TAG: wwt01/dcauto-study-resources:latest
GITHUB_BRANCH: refs/heads/main
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Display the repo branch name that triggered the GitHub Action
if: ${{ github.ref }}
run: echo ${{ github.ref }}
- name: Build and push Docker Image
if: ${{ github.ref == env.GITHUB_BRANCH }}
id: docker_build
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ env.IMAGE_TAG }}
- name: Display Docker Image digest
run: echo Image digest - ${{ steps.docker_build.outputs.digest }}