|
14 | 14 | - "packages/**" |
15 | 15 | workflow_dispatch: |
16 | 16 |
|
17 | | -env: |
18 | | - REGISTRY: ghcr.io |
19 | | - IMAGE_NAME: ${{ github.repository }}/web |
20 | | - |
21 | 17 | jobs: |
22 | | - build-and-push: |
23 | | - runs-on: ubuntu-latest |
24 | | - |
25 | | - permissions: |
26 | | - contents: read |
27 | | - packages: write |
28 | | - |
29 | | - strategy: |
30 | | - matrix: |
31 | | - platform: [linux/amd64] |
32 | | - |
33 | | - steps: |
34 | | - - uses: actions/checkout@v4 |
35 | | - |
36 | | - - name: Set up QEMU |
37 | | - uses: docker/setup-qemu-action@v3 |
38 | | - |
39 | | - - name: Set up Docker Buildx |
40 | | - uses: docker/setup-buildx-action@v3 |
41 | | - |
42 | | - - name: Check if Docker Hub secrets are available |
43 | | - run: | |
44 | | - if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then |
45 | | - echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV |
46 | | - else |
47 | | - echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV |
48 | | - fi |
49 | | -
|
50 | | - - name: Log in to Container Registry |
51 | | - uses: docker/login-action@v3 |
52 | | - if: env.DOCKERHUB_LOGIN == 'true' |
53 | | - with: |
54 | | - username: ${{ secrets.DOCKERHUB_USERNAME }} |
55 | | - password: ${{ secrets.DOCKERHUB_TOKEN }} |
56 | | - |
57 | | - - name: Extract metadata (tags, labels) for Docker |
58 | | - id: meta |
59 | | - uses: docker/metadata-action@v4 |
60 | | - with: |
61 | | - images: ctrlplane/web |
62 | | - tags: | |
63 | | - type=sha,format=short,prefix= |
64 | | -
|
65 | | - - name: Build |
66 | | - uses: docker/build-push-action@v6 |
67 | | - if: github.ref != 'refs/heads/main' |
68 | | - with: |
69 | | - push: false |
70 | | - file: apps/web/Dockerfile |
71 | | - platforms: ${{ matrix.platform }} |
72 | | - tags: ${{ steps.meta.outputs.tags }} |
73 | | - |
74 | | - - name: Build and Push |
75 | | - uses: docker/build-push-action@v6 |
76 | | - if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true' |
77 | | - with: |
78 | | - push: true |
79 | | - file: apps/web/Dockerfile |
80 | | - platforms: ${{ matrix.platform }} |
81 | | - tags: ${{ steps.meta.outputs.tags }} |
82 | | - |
83 | | - - name: Summary |
84 | | - run: | |
85 | | - echo "### Docker Image Built Successfully! 🚀" >> $GITHUB_STEP_SUMMARY |
86 | | - echo "" >> $GITHUB_STEP_SUMMARY |
87 | | - echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY |
88 | | - echo '```' >> $GITHUB_STEP_SUMMARY |
89 | | - echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY |
90 | | - echo '```' >> $GITHUB_STEP_SUMMARY |
| 18 | + build: |
| 19 | + uses: ./.github/workflows/build-image.yaml |
| 20 | + secrets: inherit |
| 21 | + with: |
| 22 | + image-name: ctrlplane/web |
| 23 | + dockerfile: apps/web/Dockerfile |
0 commit comments