diff --git a/.github/workflows/ReactAppWorkflow.yaml b/.github/workflows/ReactAppWorkflow.yaml new file mode 100644 index 0000000..fab09b7 --- /dev/null +++ b/.github/workflows/ReactAppWorkflow.yaml @@ -0,0 +1,58 @@ +name: ReactAppWorkflow +"on": + push: + branches: + - master + workflow_dispatch: {} +env: + ACR_RESOURCE_GROUP: AKSrg + AZURE_CONTAINER_REGISTRY: AKSregistar + CLUSTER_NAME: AKSclusterCICD + CLUSTER_RESOURCE_GROUP: AKSrg + CONTAINER_NAME: mypdfsample + DEPLOYMENT_MANIFEST_PATH: | + ./docker-compose.yml +jobs: + buildImage: + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - name: Build and push image to ACR + run: az acr build --image ${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.ACR_RESOURCE_GROUP }} -f ./Dockerfile ./ + deploy: + permissions: + actions: read + contents: read + id-token: write + runs-on: ubuntu-latest + needs: + - buildImage + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1.4.3 + name: Azure login + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + - uses: azure/aks-set-context@v3 + name: Get K8s context + with: + cluster-name: ${{ env.CLUSTER_NAME }} + resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }} + - uses: Azure/k8s-deploy@v4 + name: Deploys application + with: + action: deploy + images: ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} + manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }} + namespace: namespace-workflow-1663333883688 diff --git a/.github/workflows/master_reactaplikacija.yml b/.github/workflows/master_reactaplikacija.yml new file mode 100644 index 0000000..38ca169 --- /dev/null +++ b/.github/workflows/master_reactaplikacija.yml @@ -0,0 +1,51 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy container app to Azure Web App - reactaplikacija + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: 'ubuntu-latest' + + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to registry + uses: docker/login-action@v1 + with: + registry: https://acrreactapp.azurecr.io/ + username: ${{ secrets.AzureAppService_ContainerUsername_79a092e655204a13bed2db21a644bb06 }} + password: ${{ secrets.AzureAppService_ContainerPassword_aa90a770b7be408eb64e80791df62749 }} + + - name: Build and push container image to registry + uses: docker/build-push-action@v2 + with: + push: true + tags: acrreactapp.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_79a092e655204a13bed2db21a644bb06 }}/reactwebapp:${{ github.sha }} + file: ./Dockerfile + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'reactaplikacija' + slot-name: 'production' + publish-profile: ${{ secrets.AzureAppService_PublishProfile_62132923a03c4bd78e08b92317fcea26 }} + images: 'acrreactapp.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_79a092e655204a13bed2db21a644bb06 }}/reactwebapp:${{ github.sha }}' \ No newline at end of file diff --git a/src/App.js b/src/App.js index 4bb3e33..3f64c5b 100644 --- a/src/App.js +++ b/src/App.js @@ -7,7 +7,8 @@ function App() {
logo -

Bye there!

+

Bye there! by AleksandarPanchevski ke uspeam... +