forked from PillarsZhang/captcha-cv-ocr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
88 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: deploy to docker hub | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
docker-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
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 | ||
# 提供 docker 元数据,构建 docker images tag 时使用 | ||
- | ||
name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.IMAGE_NAME }} | ||
tags: | | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# tag event | ||
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag | ||
# - | ||
# name: Login to Docker Hub | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# # registry: ghcr.io # 声明镜像源 | ||
# username: ${{ secrets.DOCKER_USERNAME }} | ||
# password: ${{ secrets.DOCKER_PASSWORD }} # ${{ secrets.HUB_GITHUB_TOKEN }} | ||
# - | ||
# name: Build and push | ||
# uses: docker/build-push-action@v5 | ||
# with: | ||
# push: true | ||
# tags: ${{ steps.meta.outputs.tags }}:latest | ||
|
||
- | ||
name: Build and push Docker Image | ||
run: | | ||
docker build -t ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }} -f Dockerfile . | ||
docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }} | ||
docker push ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }} | ||
# - | ||
# name: Deploy Docker App | ||
# uses: appleboy/ssh-action@master | ||
# env: | ||
# TZ: Asia/Shanghai | ||
# with: | ||
# host: ${{ secrets.HOST }} | ||
# username: ${{ secrets.HOST_USERNAME }} | ||
# key: ${{ secrets.HOST_SSHKEY }} | ||
# port: ${{ secrets.PORT }} | ||
# script: | | ||
# wget https://raw.githubusercontent.com/${{ env.IMAGE_NAME }}/master/docker/docker-compose.yml | ||
# ls | ||
# cat docker-compose.yml | ||
# docker-compose down -v | ||
# docker-compose up -d |
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