Skip to content

Commit ab24d51

Browse files
committed
feat: 添加开发和发布部署工作流配置
1 parent a7305eb commit ab24d51

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy Rote Backend
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@v3
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Build and push Docker image
26+
uses: docker/build-push-action@v5
27+
with:
28+
context: ./backend
29+
file: ./backend/Dockerfile
30+
push: true
31+
tags: |
32+
${{ secrets.DOCKERHUB_USERNAME }}/rote-backend:latest-dev
33+
${{ secrets.DOCKERHUB_USERNAME }}/rote-backend:develop
34+
${{ secrets.DOCKERHUB_USERNAME }}/rote-backend:develop-${{ github.sha }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release Deploy Rote Backend
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
release:
8+
types: [published]
9+
10+
jobs:
11+
build-and-deploy:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
20+
21+
- name: Log in to Docker Hub
22+
uses: docker/login-action@v3
23+
with:
24+
username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
password: ${{ secrets.DOCKERHUB_TOKEN }}
26+
27+
- name: Build and push Docker image
28+
uses: docker/build-push-action@v5
29+
with:
30+
context: ./backend
31+
file: ./backend/Dockerfile
32+
push: true
33+
tags: |
34+
${{ secrets.DOCKERHUB_USERNAME }}/rote-backend:latest
35+
${{ secrets.DOCKERHUB_USERNAME }}/rote-backend:${{ github.ref_type == 'tag' && github.ref_name || 'main' }}

0 commit comments

Comments
 (0)