diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..95c8ae1 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,71 @@ +name: Deploy to Azure +on: + push: + branches: + - '**' + +jobs: + + build-frontend: + name: Build frontend images + runs-on: ubuntu-20.04 + # needs: [check-secret] + # if: needs.check-secret.outputs.aws-creds-defined == 'true' + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Log in to GHCR + id: login-ghcr + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Set the image tag + run: echo "IMAGE_NAME=$(echo ghcr.io/${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Set repository name + run: | + if [ ${{ secrets.CLUSTER_ENV }} == 'staging' ]; then + echo "REPO_NAME=staging-anythink-frontend" >> $GITHUB_ENV + else + echo "REPO_NAME=anythink-frontend" >> $GITHUB_ENV + fi + + # - name: Build and push Docker image to GHCR + # uses: docker/build-push-action@v3 + # with: + # context: . + # push: true + # tags: ghcr.io${{ steps.login-ecr.outputs.registry }}/${{ env.REPO_NAME }}:${{ env.IMAGE_TAG }} + + +# - name: Build, tag, and push frontend image to GHCR +# id: build-image-frontend +# run: | +# docker build \ +# -t $IMAGE_NAME \ +# -f frontend/Dockerfile.aws \ +# . +# docker push $IMAGE_NAME + # + - name: Log in to Azure CLI + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: Deploy to Azure Container Instances +# run: | +# az container create --resource-group Universe2023CopilotRG \ +# --name ${{ env.REPO_NAME }} \ +# --image $IMAGE_NAME \ +# --cpu 1 --memory 1 \ +# --os-type Linux \ +# --ports 3000 \ +# --dns-name-label dartest123 \ +# --registry-username vanessa-cooper \ +# --registry-password ${{ secrets.GHCR_TOKEN }} \ +# --command-line "yarn start" +# +# - name: Deploy to Azure Container Instances + run: | + az node-calculator up -n my-containerapp --source . +