|
1 | | ---- |
2 | 1 | name: Docker Publish |
3 | 2 |
|
4 | 3 | on: |
5 | | - workflow_dispatch: |
6 | 4 | push: |
7 | 5 | branches: |
8 | 6 | - main |
9 | | - tags: |
10 | | - - v* |
11 | | - - "*" |
| 7 | + - stable |
| 8 | + workflow_dispatch: |
12 | 9 |
|
13 | 10 | permissions: |
14 | 11 | packages: write |
15 | 12 | contents: read |
16 | 13 |
|
17 | 14 | env: |
18 | 15 | REGISTRY: ghcr.io |
19 | | - DOCKER_IMAGE: ghcr.io/${{ github.repository }} |
20 | | - BUILD_TARGET: bolt-ai-production # bolt-ai-development |
| 16 | + IMAGE_NAME: ${{ github.repository }} |
21 | 17 |
|
22 | 18 | jobs: |
23 | 19 | docker-build-publish: |
24 | 20 | runs-on: ubuntu-latest |
25 | 21 | steps: |
26 | | - - name: Checkout |
| 22 | + - name: Checkout code |
27 | 23 | uses: actions/checkout@v4 |
28 | 24 |
|
29 | | - - id: string |
30 | | - uses: ASzc/change-string-case-action@v6 |
31 | | - with: |
32 | | - string: ${{ env.DOCKER_IMAGE }} |
33 | | - |
34 | | - - name: Docker meta |
35 | | - id: meta |
36 | | - uses: crazy-max/ghaction-docker-meta@v5 |
37 | | - with: |
38 | | - images: ${{ steps.string.outputs.lowercase }} |
39 | | - flavor: | |
40 | | - latest=true |
41 | | - prefix= |
42 | | - suffix= |
43 | | - tags: | |
44 | | - type=semver,pattern={{version}} |
45 | | - type=pep440,pattern={{version}} |
46 | | - type=ref,event=tag |
47 | | - type=raw,value={{sha}} |
48 | | -
|
49 | | - - name: Set up QEMU |
50 | | - uses: docker/setup-qemu-action@v3 |
51 | | - |
52 | 25 | - name: Set up Docker Buildx |
53 | 26 | uses: docker/setup-buildx-action@v3 |
54 | 27 |
|
55 | | - - name: Login to Container Registry |
| 28 | + - name: Log in to GitHub Container Registry |
56 | 29 | uses: docker/login-action@v3 |
57 | 30 | with: |
58 | 31 | registry: ${{ env.REGISTRY }} |
59 | | - username: ${{ github.actor }} # ${{ secrets.DOCKER_USERNAME }} |
60 | | - password: ${{ secrets.GITHUB_TOKEN }} # ${{ secrets.DOCKER_PASSWORD }} |
| 32 | + username: ${{ github.actor }} |
| 33 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 34 | + |
| 35 | + - name: Extract metadata for Docker image |
| 36 | + id: meta |
| 37 | + uses: docker/metadata-action@v4 |
| 38 | + with: |
| 39 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
61 | 40 |
|
62 | | - - name: Build and push |
| 41 | + - name: Build and push Docker image for main |
| 42 | + if: github.ref == 'refs/heads/main' |
63 | 43 | uses: docker/build-push-action@v6 |
64 | 44 | with: |
65 | 45 | context: . |
66 | | - file: ./Dockerfile |
67 | | - target: ${{ env.BUILD_TARGET }} |
68 | | - platforms: linux/amd64,linux/arm64 |
69 | 46 | push: true |
70 | | - tags: ${{ steps.meta.outputs.tags }} |
| 47 | + tags: | |
| 48 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest |
| 49 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} |
71 | 50 | labels: ${{ steps.meta.outputs.labels }} |
72 | | - cache-from: type=registry,ref=${{ steps.string.outputs.lowercase }}:latest |
73 | | - cache-to: type=inline |
74 | 51 |
|
75 | | - - name: Check manifest |
76 | | - run: | |
77 | | - docker buildx imagetools inspect ${{ steps.string.outputs.lowercase }}:${{ steps.meta.outputs.version }} |
78 | | -
|
79 | | - - name: Dump context |
80 | | - if: always() |
81 | | - uses: crazy-max/ghaction-dump-context@v2 |
| 52 | + - name: Build and push Docker image for stable |
| 53 | + if: github.ref == 'refs/heads/stable' |
| 54 | + uses: docker/build-push-action@v6 |
| 55 | + with: |
| 56 | + context: . |
| 57 | + push: true |
| 58 | + tags: | |
| 59 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:stable |
| 60 | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} |
| 61 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments