Feat/v1.1.0 (#67) #93
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: App and API Images | |
| on: | |
| push: | |
| tags: ["v*"] | |
| env: | |
| REGISTRY: chaitin-registry.cn-hangzhou.cr.aliyuncs.com | |
| NAMESPACE: koalaqa | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| service: | |
| - name: api | |
| dockerfile: backend/Dockerfile | |
| context: backend | |
| - name: app | |
| dockerfile: ui/Dockerfile | |
| context: ui | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract tag name and build time | |
| id: extract_tag | |
| run: | | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Aliyun Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.ALIYUN_CLOUD_USERNAME }} | |
| password: ${{ secrets.ALIYUN_CLOUD_PASSWORD }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ matrix.service.context }} | |
| file: ${{ matrix.service.dockerfile }} | |
| push: true | |
| tags: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.service.name }}:${{ steps.extract_tag.outputs.tag }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: false | |
| sbom: false | |
| build-args: | | |
| VERSION=${{ steps.extract_tag.outputs.tag }} | |
| COMMIT_HASH=${{ github.sha }} | |
| BUILD_TIME=${{ steps.extract_tag.outputs.build_time }} | |
| HTTP_PROXY=${{ secrets.HTTP_PROXY }} | |
| HTTPS_PROXY=${{ secrets.HTTPS_PROXY }} | |
| notify: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Extract tag name | |
| id: extract_tag | |
| run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Build result notification | |
| run: | | |
| if [ "${{ needs.build-and-push.result }}" == "success" ]; then | |
| echo "✅ App and UI images built successfully!" | |
| echo "🚀 Images pushed to Aliyun Cloud: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}" | |
| echo "📦 Tag: ${{ steps.extract_tag.outputs.tag }}" | |
| else | |
| echo "❌ App and UI image build failed, please check logs" | |
| exit 1 | |
| fi |