|
| 1 | +name: Release Publish |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: |
| 5 | + - created |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-context: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Dump GitHub context |
| 12 | + env: |
| 13 | + GITHUB_CONTEXT: ${{ toJson(github) }} |
| 14 | + run: echo "$GITHUB_CONTEXT" |
| 15 | + build: |
| 16 | + needs: build-context |
| 17 | + runs-on: ubuntu-latest |
| 18 | + env: |
| 19 | + PLATFORMS: "linux/amd64,linux/arm64" |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Env seen prerun |
| 25 | + run: env |
| 26 | + |
| 27 | + - name: Get branch metadata |
| 28 | + id: branch-name |
| 29 | + uses: tj-actions/branch-names@v8 |
| 30 | + |
| 31 | + - name: Current tag name |
| 32 | + run: | |
| 33 | + echo "Tag if exist: ${{ steps.branch-name.outputs.tag }}" |
| 34 | +
|
| 35 | + - name: If not a tag, terminate the workflow |
| 36 | + if: steps.branch-name.outputs.is_tag != 'true' |
| 37 | + run: exit 1 |
| 38 | + |
| 39 | + - name: Running on a tag. |
| 40 | + run: | |
| 41 | + echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV} |
| 42 | +
|
| 43 | + # setup Docker build action |
| 44 | + - name: Set up Docker Buildx |
| 45 | + id: buildx |
| 46 | + uses: docker/setup-buildx-action@v3 |
| 47 | + - name: Set up QEMU |
| 48 | + id: qemu |
| 49 | + uses: docker/setup-qemu-action@v3 |
| 50 | + |
| 51 | + - name: Login to DockerHub |
| 52 | + uses: docker/login-action@v3 |
| 53 | + with: |
| 54 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 55 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 56 | + |
| 57 | + - name: Build crapi-identity all platforms and push to Docker Hub |
| 58 | + uses: docker/build-push-action@v3 |
| 59 | + with: |
| 60 | + context: ./services/identity |
| 61 | + tags: crapi/crapi-identity:${{ env.TAG_NAME }} |
| 62 | + platforms: ${{ env.PLATFORMS }} |
| 63 | + push: true |
| 64 | + cache-from: type=gha,scope=identity-service |
| 65 | + cache-to: type=gha,mode=max,scope=identity-service |
| 66 | + |
| 67 | + - name: Build crapi-workshop all platforms and push to Docker Hub |
| 68 | + uses: docker/build-push-action@v3 |
| 69 | + with: |
| 70 | + context: ./services/workshop |
| 71 | + tags: crapi/crapi-workshop:${{ env.TAG_NAME }} |
| 72 | + platforms: ${{ env.PLATFORMS }} |
| 73 | + push: true |
| 74 | + cache-from: type=gha,scope=workshop-service |
| 75 | + cache-to: type=gha,mode=max,scope=workshop-service |
| 76 | + |
| 77 | + - name: Build crapi-chatbot all platforms and push to Docker Hub |
| 78 | + uses: docker/build-push-action@v3 |
| 79 | + with: |
| 80 | + context: ./services/chatbot |
| 81 | + tags: crapi/crapi-chatbot:${{ env.TAG_NAME }} |
| 82 | + platforms: ${{ env.PLATFORMS }} |
| 83 | + push: true |
| 84 | + cache-from: type=gha,scope=chatbot-service |
| 85 | + cache-to: type=gha,mode=max,scope=chatbot-service |
| 86 | + |
| 87 | + - name: Build crapi-community all platforms and push to Docker Hub |
| 88 | + uses: docker/build-push-action@v3 |
| 89 | + with: |
| 90 | + context: ./services/community |
| 91 | + tags: crapi/crapi-community:${{ env.TAG_NAME }} |
| 92 | + platforms: ${{ env.PLATFORMS }} |
| 93 | + push: true |
| 94 | + cache-from: type=gha,scope=community-service |
| 95 | + cache-to: type=gha,mode=max,scope=community-service |
| 96 | + |
| 97 | + - name: Build crapi-web all platforms and push to Docker Hub |
| 98 | + uses: docker/build-push-action@v3 |
| 99 | + with: |
| 100 | + context: ./services/web |
| 101 | + tags: crapi/crapi-web:${{ env.TAG_NAME }} |
| 102 | + platforms: ${{ env.PLATFORMS }} |
| 103 | + push: true |
| 104 | + cache-from: type=gha,scope=web-service |
| 105 | + cache-to: type=gha,mode=max,scope=web-service |
| 106 | + |
| 107 | + - name: Build gateway-service all platforms and push to Docker Hub |
| 108 | + uses: docker/build-push-action@v3 |
| 109 | + with: |
| 110 | + context: ./services/gateway-service |
| 111 | + tags: crapi/gateway-service:${{ env.TAG_NAME }} |
| 112 | + platforms: ${{ env.PLATFORMS }} |
| 113 | + push: true |
| 114 | + cache-from: type=gha,scope=gateway-service |
| 115 | + cache-to: type=gha,mode=max,scope=gateway-service |
| 116 | + |
| 117 | + - name: Build mailhog all platforms and push to Docker Hub |
| 118 | + uses: docker/build-push-action@v3 |
| 119 | + with: |
| 120 | + context: ./services/mailhog |
| 121 | + tags: crapi/mailhog:${{ env.TAG_NAME }} |
| 122 | + platforms: ${{ env.PLATFORMS }} |
| 123 | + push: true |
| 124 | + cache-from: type=gha,scope=mailhog-service |
| 125 | + cache-to: type=gha,mode=max,scope=mailhog-service |
| 126 | + |
0 commit comments