Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ac72569
Create build.yml
lateef-taiwo Jan 6, 2024
aee5053
Update build.yml
lateef-taiwo Jan 6, 2024
2950a3e
modified build.yml
lateef-taiwo Jan 6, 2024
a94c019
modified build.yml
lateef-taiwo Jan 6, 2024
91d5da2
Added github/workflows/generate-ascii.yml
lateef-taiwo Jan 6, 2024
c37fdb0
modified build.yml
lateef-taiwo Jan 6, 2024
270ba8d
Create script.sh
lateef-taiwo Jan 6, 2024
e2a3413
Executing Shell Script
lateef-taiwo Jan 6, 2024
bc6045b
Added permissions to run the script
lateef-taiwo Jan 6, 2024
6309f80
Added more jobs
lateef-taiwo Jan 6, 2024
f6dcb86
modified generate-ascii.yml
lateef-taiwo Jan 6, 2024
b17e447
modified generate-ascii.yml
lateef-taiwo Jan 6, 2024
8c89c7b
Added variables-secrets.yml
lateef-taiwo Jan 7, 2024
e7c6514
modified variables-secrets.yml
lateef-taiwo Jan 7, 2024
862dd85
modified generate-ascii.yml
lateef-taiwo Jan 7, 2024
6da0abf
modifed variables-secrets.yml
lateef-taiwo Jan 7, 2024
8f069c1
modified variable-secrets.yml
lateef-taiwo Jan 7, 2024
c57c593
modified variable-secrets.yml
lateef-taiwo Jan 7, 2024
e7e7705
modified variable-secrets.yml
lateef-taiwo Jan 7, 2024
ee768fd
modified matrix-configuration.yml
lateef-taiwo Jan 7, 2024
98dfdca
modified matrix-configuration.yml
lateef-taiwo Jan 7, 2024
f745505
added context-texting.yml
lateef-taiwo Jan 7, 2024
8eea968
renamed context-texting to context-testing
lateef-taiwo Jan 7, 2024
27844f0
modified variables-secrets.yml
lateef-taiwo Jan 7, 2024
4e4e71d
modified variable-secrets.yml
lateef-taiwo Jan 7, 2024
ec98eb2
modified variable-secrets.yml
lateef-taiwo Jan 7, 2024
37ab08b
added workflow-filters.yml
lateef-taiwo Jan 7, 2024
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
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CICD PIPELINE

on: push

jobs:
first_job:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: List and Read Files
run: |
echo "This is a pipeline for Netflix clone App"
ls -lrta
cat README.md

- name: Generate ASCII ArtWork
run: cowsay -f dragon "Run for cover, I am a Dragon....RAWR" >> dragon.txt


# - name: List Files
# run: ls

# - name: Read file
# run: cat README.md
27 changes: 27 additions & 0 deletions .github/workflows/context-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Context testing
on: push

jobs:
dump_contexts_to_log:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump secret context
env:
SECRET_CONTEXT: ${{ toJson(secrets) }}
run: echo "$SECRET_CONTEXT"
74 changes: 74 additions & 0 deletions .github/workflows/generate-ascii.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Generate ASCII Artwork

on:
push

jobs:
build_job_1:
runs-on: ubuntu-latest
steps:
- name: Install Cowsay Program
run: sudo apt-get install cowsay -y

- name: Execute Cowsay CMD
run: cowsay -f dragon "Run for cover, I am a Dragon....RAWR" >> dragon.txt

- name: Upload Dragon Text File
uses: actions/upload-artifact@v4
with:
name: dragon-text-file
path: dragon.txt

test_job_2:
needs: build_job_1 # use needs to specify a job which the current job depends on
runs-on: ubuntu-latest
steps:
- name: Download Dragon Text File
uses: actions/download-artifact@v4
with:
name: dragon-text-file
# we don't need to specify a part for the download
- name: Test File Exists
run: grep -i "dragon" dragon.txt

deploy_job_3:
needs: [test_job_2] # You can define the jobs it needs as an array if they are more than one, I only used the array here for example and as part of my documentation
runs-on: ubuntu-latest
steps:
- name: Download Dragon Text File
uses: actions/download-artifact@v4
with:
name: dragon-text-file
# it is optional to specify a part for the download

- name: Read File
run: cat dragon.txt

- name: Deploy
run: echo Deploy ... ... ... ...


# - name: Checkout Repo
# uses: actions/checkout@v4

# - name: List Repo Files
# run: ls -ltra

# - name: Executing Shell Script
# run: |
# chmod +x script.sh
# ./script.sh

# - name: Install Cowsay Program
# run: sudo apt-get install cowsay -y

# - name: Execute Cowsay CMD
# run: cowsay -f dragon "Run for cover, I am a Dragon....RAWR" >> dragon.txt

# - name: Check if Test File Exists
# run: grep -i "dragon" dragon.txt

# - name: Read file
# run: cat dragon.txt


28 changes: 28 additions & 0 deletions .github/workflows/matrix-configuration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Matrix Configuration

on:
push:
workflow_dispatch:

jobs:
deploy:
strategy:
fail-fast: false #disable fail-fast using false. This prevents GitHub from cancelling any job in prgress if any job in the matrix fails
max-parallel: 2 # control the number of jobs that can run parrelling by setting it to 2 parrallel jobs
matrix:
os: [ubuntu-latest, ubuntu-20.04, windows-latest]
images: [hello-world, alpine]
# This is supposed to run 6 jobs, but will not run up to 6 because of the exclude operation
exclude:
- images: alpine
os: windows-latest
include:
- images: amd64/alpine
os: ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
- name: Echo Docker Details
run: docker info

- name: Run Image on ${{ matrix.os }}
run: docker run ${{ matrix.images }}
176 changes: 176 additions & 0 deletions .github/workflows/variable-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# name: Exploring variables and secrets

# on:
# push

# #Environment variable defined at the workflow level

# env:
# CONTAINER_REGISTRY: docker.io
# DOCKER_USERNAME: siddharth1
# IMAGE_NAME: github-actions-nginx

# jobs:

# docker:
# runs-on: ubuntu-latest
# steps:
# - name: Docker Build
# run: docker build -t docker.io/dockerusername/imageName:latest

# - name: Docker Login
# run: docker login --username=dockerUsername --pasword=s3cUrePaSsw0rd

# - name: Docker Publish
# run: docker push docker.io/dockerusername/imageName:latest


# deploy:
# needs: docker
# runs-on: ubuntu-latest
# steps:
# - name: Docker Run
# run: docker run -d -p 8080:80 docker.io/dockerusername/imageName:latest


################## environment variables at STEP level #####################

# Note it is best to define environment variables at the job level so that they can be reusable in different jobs

# docker:
# runs-on: ubuntu-latest
# steps:
# - name: Docker Build
# env:
# CONTAINER_REGISTRY: docker.io
# DOCKER_USERNAME: siddharth1
# IMAGE_NAME: github-actions-nginx
# run: echo docker build -t $CONTAINER_REGISTRY/$DOCKER_USERNAME/$IMAGE_NAME:latest

# - name: Docker Login
# env:
# DOCKER_PASSWORD: s3cUrePaSsw0rd
# DOCKER_USERNAME: siddharth1
# run: echo docker login --username=$DOCKER_USERNAME --password=$DOCKER_PASSWORD

# - name: Docker Publish
# env: # Define environment variables
# CONTAINER_REGISTRY: docker.io
# DOCKER_USERNAME: siddharth1
# IMAGE_NAME: github-actions-nginx
# run: echo docker push $CONTAINER_REGISTRY/$DOCKER_USERNAME/$IMAGE_NAME:latest

# deploy:
# needs: docker
# runs-on: ubuntu-latest
# steps:
# - name: Docker Run
# env:
# CONTAINER_REGISTRY: docker.io
# DOCKER_USERNAME: siddharth1
# IMAGE_NAME: github-actions-nginx
# run: echo docker run -d -p 8080:80 ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest
# # Another way to use environment variables is using curly braces {{env.}}


################## environment variables at JOB level #####################

# Note it is good to define environment variables at the job level so that they can be reusable in different jobs

# docker:
# env:
# CONTAINER_REGISTRY: docker.io
# DOCKER_USERNAME: siddharth1
# IMAGE_NAME: github-actions-nginx
# runs-on: ubuntu-latest
# steps:
# - name: Docker Build
# run: echo docker build -t ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest

# - name: Docker Login
# env:
# DOCKER_PASSWORD: S3cUrePaSsw0rd
# run: echo docker login --username=$DOCKER_USERNAME --password=$DOCKER_PASSWORD

# - name: Docker Publish
# run: echo docker push ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest


# deploy:
# env:
# CONTAINER_REGISTRY: docker.io
# DOCKER_USERNAME: siddharth1
# IMAGE_NAME: github-actions-nginx
# needs: docker
# runs-on: ubuntu-latest
# steps:
# - name: Docker Run
# run: docker run -d -p 8080:80 ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest


################## environment variables at Workflow level #####################
# Defining evironment variables at the Workflow level

# docker:
# runs-on: ubuntu-latest
# steps:
# - name: Docker Build
# run: echo docker build -t ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest

# - name: Docker Login
# env:
# DOCKER_PASSWORD: S3cUrePaSsw0rd
# run: echo docker login --username=$DOCKER_USERNAME --password=$DOCKER_PASSWORD

# - name: Docker Publish
# run: echo docker push ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest


# deploy:
# needs: docker
# runs-on: ubuntu-latest
# steps:
# - name: Docker Run
# run: docker run -d -p 8080:80 ${{ env.CONTAINER_REGISTRY }}/${{ env.DOCKER_USERNAME}}/${{ env.IMAGE_NAME}}:latest


########### environment variables and secrets at the repository level ####################

name: Exploring Variables and Secrets

on:
workflow_dispatch: # To manually trigger the workflow
# schedule:
# - cron: '*/1 * * * *'
push:

env:
CONTAINER_REGISTRY: docker.io
IMAGE_NAME: github-actions-nginx

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Docker Build
run: echo docker build -t ${{ env.CONTAINER_REGISTRY }}/${{ vars.DOCKER_USERNAME }}/$IMAGE_NAME:latest

- name: Docker Login
run: echo docker login --username=${{ vars.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}

- name: Docker Publish
run: echo docker push $CONTAINER_REGISTRY/${{ vars.DOCKER_USERNAME }}/$IMAGE_NAME:latest

deploy:
if: github.ref == 'refs/heads/main' #set condition that the deploy job should run only on the main branch
needs: docker
concurrency:
group: production-deployment # set concurrency group
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Docker Run
timeout-minutes: 1
run: |
echo docker run -d -p 8080:80 $CONTAINER_REGISTRY/${{ vars.DOCKER_USERNAME }}/$IMAGE_NAME:latest
#sleep 600s
28 changes: 28 additions & 0 deletions .github/workflows/workflow-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Workflow Filters and Activities

on:
workflow_dispatch:
# schedule:
# - cron: "*/59 * * * *"
push:
branches:
- main
- '!feature/*' # ignoring pushing to any branch name starting with feature using !
# branches-ignore:
# - feature/* # feature/add-music, feature/updateImages
# - test/** # test/ui/index, test/checkout/payment/

pull_request:
types:
- opened
- closed
paths-ignore: # workflow will only run when a pull request that includes a change on any file other than README.md
- README.md
branches:
- main # configures your workflow to only run on pull requests that target specific branches.

jobs:
hello:
runs-on: ubuntu-latest
steps:
- run: echo this workflow/job/step is executed for event type - ${{ github.event_name }}
6 changes: 6 additions & 0 deletions script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
sudo apt-get install cowsay -y
cowsay -f dragon "Run for cover, I am a Dragon....RAWR" >> dragon.txt
grep -i "dragon" dragon.txt
cat dragon.txt
ls -ltra