Skip to content
Open
53 changes: 53 additions & 0 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
@@ -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!

47 changes: 47 additions & 0 deletions .github/workflows/DeploymentToAKS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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 ./
- uses: actions/upload-artifact@main
with:
name: webpack artifacts
path: public/

# Check the code linter errors and warnings
# - name: Check the code linter errors and warnings
# shell: bash
# run: bash ${GITHUB_WORKSPACE}/.github/scripts/code_linter.sh
- name: Run this step only if container images were found in the cache
if: github.event.ref == 'refs/heads/main'
shell: bash
run: echo "Container images were found in the cache..."

48 changes: 48 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ WORKDIR /usr/src/app
COPY my-app/ ./my-app/
RUN cd my-app && npm install @angular/cli && npm install && npm run build


FROM nginx:alpine

#!/bin/sh
Expand Down
1 change: 1 addition & 0 deletions my-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@