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
34 changes: 34 additions & 0 deletions .github/workflows/vishaalpal-c05-actions02-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
pull_request:
paths:
- 'vishaalpal/c05-actions02/*'

jobs:
comment_pr:
runs-on: ubuntu-latest
name: 3m to build, push and comment pr
steps:
- name: Checkout
uses: actions/checkout@v1

- name: login docker hub
env:
VISHAALPAL_DH_TOKEN: ${{ secrets.VISHAALPAL_DH_TOKEN }}
VISHAALPAL_DH_USERNAME: ${{ secrets.VISHAALPAL_DH_USERNAME }}
working-directory: vishaalpal/c05-actions02/
run: make login_dockerhub

- name: build docker image
working-directory: vishaalpal/c05-actions02/
run: make build_image

- name: push docker image
id: push_image_id
working-directory: vishaalpal/c05-actions02/
run: make push_image

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: 'Image name ${{ env.FULLIMAGEID }} has been pushed to dockerhub.'
GITHUB_TOKEN: ${{ secrets.VISHAALPAL_GH_PAT }}
19 changes: 19 additions & 0 deletions .github/workflows/vishaalpal-gh-actions-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
pull_request:
paths:
- 'vishaalpal/*'

jobs:
comment_pr:
runs-on: ubuntu-latest
name: Comment on all PRs targeting vishaalpal/*
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1

with:
message: 'Well done ${{ secrets.VISHAALPAL_NAME }} ! This is a nice PR.'
GITHUB_TOKEN: ${{ secrets.VISHAALPAL_GH_PAT }}
1 change: 1 addition & 0 deletions vishaalpal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a README file for exercise c05-actions01 by vishaalpal.
2 changes: 2 additions & 0 deletions vishaalpal/c05-actions02/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM httpd:2.4.41
RUN echo "This is my GH actions exercise v2." > /usr/local/apache2/htdocs/index.html
20 changes: 20 additions & 0 deletions vishaalpal/c05-actions02/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export SC_SHA = $(shell git rev-parse --short HEAD)
export IMAGE_NAME = vee94/c05-actions02
export FULL_IMAGE_NAME = "$(IMAGE_NAME):$(SC_SHA)"
DOCKER_COMPOSE = docker-compose build
DOCKERHUB_PUSH = docker push $(IMAGE_NAME):$(SC_SHA)

all: build_image push_image

.PHONY: build_image
build_image:
$(DOCKER_COMPOSE)

.PHONY: login_dockerhub
login_dockerhub:
@echo $(VISHAALPAL_DH_TOKEN) | docker login -u $(VISHAALPAL_DH_USERNAME) --password-stdin

.PHONY: push_image
push_image:
$(DOCKERHUB_PUSH)
echo "FULLIMAGEID=$(IMAGE_NAME):$(SC_SHA)" >> $(GITHUB_ENV)
1 change: 1 addition & 0 deletions vishaalpal/c05-actions02/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a README file for exercise c05-actions02 by vishaalpal.
5 changes: 5 additions & 0 deletions vishaalpal/c05-actions02/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: '3.8'
services:
web:
image: ${IMAGE_NAME}:${SC_SHA}
build: .
34 changes: 34 additions & 0 deletions vishaalpal/c05-actions02/vishaalpal-c05-actions02-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
pull_request:
paths:
- 'vishaalpal/c05-actions02/*'

jobs:
comment_pr:
runs-on: ubuntu-latest
name: 3m to build, push and comment pr
steps:
- name: Checkout
uses: actions/checkout@v1

- name: login docker hub
env:
VISHAALPAL_DH_TOKEN: ${{ secrets.VISHAALPAL_DH_TOKEN }}
VISHAALPAL_DH_USERNAME: ${{ secrets.VISHAALPAL_DH_USERNAME }}
working-directory: vishaalpal/c05-actions02/
run: make login_dockerhub

- name: build docker image
working-directory: vishaalpal/c05-actions02/
run: make build_image

- name: push docker image
id: push_image_id
working-directory: vishaalpal/c05-actions02/
run: make push_image

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: 'Image name ${{ env.FULLIMAGEID }} has been pushed to dockerhub.'
GITHUB_TOKEN: ${{ secrets.VISHAALPAL_GH_PAT }}
19 changes: 19 additions & 0 deletions vishaalpal/c05-actions02/vishaalpal-gh-actions-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
pull_request:
paths:
- 'vishaalpal/*'

jobs:
comment_pr:
runs-on: ubuntu-latest
name: Comment on all PRs targeting vishaalpal/*
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Comment PR
uses: thollander/actions-comment-pull-request@v1

with:
message: 'Well done ${{ secrets.VISHAALPAL_NAME }} ! This is a nice PR.'
GITHUB_TOKEN: ${{ secrets.VISHAALPAL_GH_PAT }}