Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!

33 changes: 33 additions & 0 deletions .github/workflows/DeploymentToAKS.yml
Original file line number Diff line number Diff line change
@@ -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 ./
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: 1 addition & 0 deletions my-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@