diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml new file mode 100644 index 0000000..18182f4 --- /dev/null +++ b/.github/workflows/CICD.yml @@ -0,0 +1,53 @@ +name: CI + CD + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + Build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Compile + run: echo Hello, world! + + DeployDev: + name: Deploy to Dev + if: github.event_name == 'pull_request' + needs: [Build] + runs-on: ubuntu-latest + environment: + name: Development + url: 'http://dev.myapp.com' + steps: + - name: Deploy + run: echo I am deploying! + + DeployStaging: + name: Deploy to Staging + if: github.event.ref == 'refs/heads/main' + needs: [Build] + runs-on: ubuntu-latest + environment: + name: Staging + url: 'http://test.myapp.com' + steps: + - name: Deploy + run: echo I am deploying! + + DeployProd: + name: Deploy to Production + needs: [DeployStaging] + runs-on: ubuntu-latest + environment: + name: Production + url: 'http://www.myapp.com' + steps: + - name: Deploy + run: echo I am deploying! + diff --git a/.github/workflows/DeploymentToAKS.yml b/.github/workflows/DeploymentToAKS.yml new file mode 100644 index 0000000..496e724 --- /dev/null +++ b/.github/workflows/DeploymentToAKS.yml @@ -0,0 +1,33 @@ +name: Deployment +"on": + push: + branches: + - master + paths: + - my-app/** + workflow_dispatch: {} +env: + ACR_RESOURCE_GROUP: AZ_RG + AZURE_CONTAINER_REGISTRY: bgswacr + CLUSTER_NAME: bgswaks + CLUSTER_RESOURCE_GROUP: AZ_RG + CONTAINER_NAME: image-workflow-1693495803035 + DEPLOYMENT_MANIFEST_PATH: | + manifests/deployment.yaml + manifests/service.yaml +jobs: + buildImage: + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: azure/login@v1 + 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 ./ diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..0c5a402 --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,48 @@ +name: Pull Request Example + +on: + pull_request: + branches: + - main + paths: + - typescript-project/** + workflow_dispatch: + +jobs: + pull-request: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: typescript-project + + steps: + - uses: actions/checkout@v2 + + # Setup Nodejs + - name: Setup Node.js 16 + uses: actions/setup-node@v2 + with: + node-version: "16.x" + cache: 'npm' + cache-dependency-path: typescript-project/yarn.lock + + # Install Yarn + - name: Install Yarn + run: npm install --global yarn + + # Install libraries + - name: Install dependencies + run: yarn install --frozen-lockfile + + # Run linting + - name: Run linting + run: yarn lint + + # Compile the code + - name: Build project + run: yarn build + + # Run tests + - name: Run tests + run: yarn test diff --git a/my-app/Dockerfile b/my-app/Dockerfile index e69de29..56f3b36 100644 --- a/my-app/Dockerfile +++ b/my-app/Dockerfile @@ -0,0 +1 @@ +