-
Notifications
You must be signed in to change notification settings - Fork 45
96 lines (80 loc) · 2.7 KB
/
docker-release.yml
File metadata and controls
96 lines (80 loc) · 2.7 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build and Push Docker Images
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
# 检查是否修改了drizzle的数据库配置, 修改了才需要更新migrate镜像
detect-migrate-changes:
runs-on: ubuntu-latest
outputs:
should_build_migrate: ${{ steps.filter.outputs.migrate }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Detect migration-related changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
migrate:
- 'drizzle/**'
- 'scripts/migrate.mjs'
- 'Dockerfile.migrate'
build-app:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get lowercase repository owner
id: lowercase
run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and Push App Image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ steps.lowercase.outputs.owner }}/cliproxyapi-monitor:latest
cache-from: type=gha
cache-to: type=gha,mode=min
build-migrate:
runs-on: ubuntu-latest
needs: detect-migrate-changes
if: github.event_name == 'workflow_dispatch' || needs.detect-migrate-changes.outputs.should_build_migrate == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get lowercase repository owner
id: lowercase
run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Build and Push Migration Image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.migrate
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ steps.lowercase.outputs.owner }}/cliproxyapi-monitor-migrate:latest
cache-from: type=gha
cache-to: type=gha,mode=min