diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index f711e051d2c..9e97ecbf7e0 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -3,10 +3,10 @@ name: Build-Test on: push: branches: - - "*" # Trigger on push to any branch + - "test" # Trigger on push to any branch pull_request: branches: - - "*" # Trigger on pull request to any branch + - "test" # Trigger on pull request to any branch jobs: ci-cd-TestCases: diff --git a/.github/workflows/build-upload-artifact.yml b/.github/workflows/build-upload-artifact.yml index c31e57fd214..af8d848d8f0 100644 --- a/.github/workflows/build-upload-artifact.yml +++ b/.github/workflows/build-upload-artifact.yml @@ -3,10 +3,10 @@ name: Build and Upload Artifact on: push: branches: - - "deploy" # Trigger on push to the "deploy" branch + - "*" # Trigger on push to the "deploy" branch pull_request: branches: - - "deploy" # Trigger on pull request to the "deploy" branch + - "*" # Trigger on pull request to the "deploy" branch jobs: build_and_deploy: @@ -37,40 +37,27 @@ jobs: commit_hash=$(git rev-parse --short HEAD) # Get commit hash build_tag=$(echo "${{ github.ref }}" | rev | cut -d/ -f1 | rev)_${commit_hash}_${GITHUB_RUN_NUMBER} # Generate build tag echo "build_tag=$build_tag" >> $GITHUB_ENV # Save build tag to environment variable - bash ./build.sh "${build_tag}" "${{ env.NODE_NAME }}" "test" true false "" # Run build script with parameters + docker build -t myapp:${build_tag} . # Build Docker image env: NODE_NAME: "18.20.2" # Set environment variable NODE_NAME - # - name: Log in to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_USERNAME }} - # password: ${{ secrets.DOCKER_PASSWORD }} - - # - name: Push Docker Image - # run: | - # docker tag my-app:${{ env.build_tag }} ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }} - # docker push ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }} + - name: Docker Login + uses: azure/docker-login@v1 + with: + login-server: ${{ secrets.AZURE_URL }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} - # - name: Push Docker Image - # uses: docker/build-push-action@v4 - # with: - # context: . - # # file: ./Dockerfile # Path to your Dockerfile - # push: true - # tags: ${{ secrets.DOCKER_USERNAME }}/my-app:${{ env.build_tag }} + - name: Build and Push to ACR + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.AZURE_URL }}/myapp:${{ env.build_tag }} + file: Dockerfile - name: Archive Artifacts uses: actions/upload-artifact@v2 with: name: metadata - path: metadata.json - - - name: Archive CDN assets if required - if: ${{ github.event.inputs.buildCdnAssests == 'true' }} # Conditional step execution - run: | - rm -rf cdn_assets # Remove existing CDN assets directory - mkdir cdn_assets # Create CDN assets directory - cp -r src/app/dist-cdn/* cdn_assets/ # Copy CDN assets - zip -Jr cdn_assets.zip cdn_assets # Create zip file of CDN assets - echo "##vso[task.uploadfile]cdn_assets.zip" # Upload CDN assets zip file + path: myapp_${{ env.build_tag }}.tar