Skip to content

Commit 5652ee9

Browse files
authored
GitHub Action 自动化编译推送 docker镜像脚本 (#64)
* Create template docker-image.yml * add: script that automatically build docker image and push to DockerHub * add: manually trigger
1 parent b8551ec commit 5652ee9

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# author: 0-8-4
2+
# date: 24-11-2022 18:34 AEDT
3+
#
4+
# This script is used to automatically build docker image and
5+
# push to DockerHub when every new release is published
6+
7+
name: Docker Image CI
8+
9+
on:
10+
release:
11+
types: [published]
12+
workflow_dispatch:
13+
14+
env:
15+
DOCKERHUB_REPO: o1si/miui-auto-tasks
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
-
22+
name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
25+
-
26+
name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
29+
-
30+
name: Login to Docker Hub
31+
uses: docker/login-action@v2
32+
with:
33+
username: ${{ secret.DOCKERHUB_USERNAME }}
34+
password: ${{ secret.DOCKERHUB_TOKEN }}
35+
36+
-
37+
name: Build and push
38+
uses: docker/build-push-action@v3
39+
with:
40+
push: true
41+
platforms: |
42+
linux/amd64
43+
linux/arm64
44+
tags: |
45+
${{ env.DOCKERHUB_REPO }}:latest
46+
${{ env.DOCKERHUB_REPO }}:${{ github.event.release.tag_name }}
47+

0 commit comments

Comments
 (0)