11on :
22 push :
3- branches :
4- - " master"
53 tags :
64 - " v*.*.*"
75 workflow_dispatch :
@@ -14,123 +12,9 @@ permissions:
1412 id-token : write
1513
1614jobs :
17- build-dev-image-with-sentry :
18- name : Build development image with Sentry
19- if : github.ref_type == 'branch' && (github.ref_name == 'master' || startsWith(github.ref_name, 'feature/'))
20- runs-on : ubuntu-latest
21- environment : dev
22-
23- steps :
24- - name : Checkout repository
25- uses : actions/checkout@v4
26- with :
27- fetch-depth : 0
28-
29- - name : Set up Docker Buildx
30- uses : docker/setup-buildx-action@v3
31-
32- - name : Extract app version from pubspec.yaml
33- id : app_version
34- run : |
35- VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}')
36- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
37-
38- - name : Docker metadata
39- id : meta
40- uses : docker/metadata-action@v5
41- with :
42- images : |
43- ${{ github.repository_owner }}/tmail-web
44- ghcr.io/${{ github.repository_owner }}/tmail-web
45- tags : |
46- type=ref,event=branch
47-
48- - name : Login to Docker Hub
49- uses : docker/login-action@v3
50- with :
51- username : ${{ secrets.DOCKERHUB_USERNAME }}
52- password : ${{ secrets.DOCKERHUB_TOKEN }}
53-
54- - name : Login to GitHub Container Registry
55- uses : docker/login-action@v3
56- with :
57- registry : ghcr.io
58- username : ${{ github.actor }}
59- password : ${{ secrets.GITHUB_TOKEN }}
60-
61- - name : Build and push image (dev)
62- uses : docker/build-push-action@v5
63- with :
64- context : .
65- file : ./Dockerfile
66- push : true
67- platforms : linux/amd64,linux/arm64
68- cache-from : |
69- type=gha
70- cache-to : |
71- type=gha
72- build-args : |
73- FLUTTER_VERSION=3.32.8
74- SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
75- SENTRY_ORG=${{ secrets.SENTRY_ORG }}
76- SENTRY_PROJECT=${{ secrets.SENTRY_PROJECT }}
77- SENTRY_URL=${{ secrets.SENTRY_URL }}
78- SENTRY_RELEASE=${{ steps.app_version.outputs.version }}
79- GITHUB_SHA=${{ github.sha }}
80- tags : ${{ steps.meta.outputs.tags }}
81- labels : ${{ steps.meta.outputs.labels }}
82-
83- - name : Extract sourcemaps from Docker image
84- if : always()
85- run : |
86- # Get the first image tag (for amd64 platform)
87- IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
88-
89- if [ -z "$IMAGE_TAG" ]; then
90- echo "No image tag found, skipping sourcemap extraction"
91- exit 0
92- fi
93-
94- echo "Extracting sourcemaps from image: $IMAGE_TAG"
95-
96- # Create temporary container to extract files
97- CONTAINER_ID=$(docker create --platform linux/amd64 "$IMAGE_TAG" 2>/dev/null | head -n1)
98-
99- if [ -n "$CONTAINER_ID" ]; then
100- echo "Created container: $CONTAINER_ID"
101-
102- # Create directory for sourcemaps
103- mkdir -p sourcemaps
104-
105- # Copy all files from container
106- docker cp "$CONTAINER_ID:/usr/share/nginx/html/." sourcemaps/ 2>/dev/null || true
107-
108- # Remove container
109- docker rm "$CONTAINER_ID" 2>/dev/null || true
110-
111- # Filter only .map files and keep directory structure
112- find sourcemaps -type f ! -name "*.map" -delete 2>/dev/null || true
113-
114- echo "Sourcemaps extracted:"
115- find sourcemaps -name "*.map" | head -10 || echo "No .map files found"
116- MAP_COUNT=$(find sourcemaps -name "*.map" 2>/dev/null | wc -l)
117- echo "Total .map files: $MAP_COUNT"
118- else
119- echo "Warning: Could not create container from image"
120- fi
121-
122- - name : Upload sourcemaps as artifact
123- if : always()
124- uses : actions/upload-artifact@v4
125- with :
126- name : sourcemaps-${{ steps.app_version.outputs.version }}
127- path : sourcemaps/**/*.map
128- retention-days : 30
129- if-no-files-found : warn
130-
13115 build-release-image-with-sentry :
13216 name : Build release image with Sentry
133- if : github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
17+ if : github.event_name == 'workflow_dispatch' || (github. ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') )
13418 runs-on : ubuntu-latest
13519 environment : prod
13620
0 commit comments