diff --git a/.github/workflows/vishaalpal-c05-actions02-workflow.yaml b/.github/workflows/vishaalpal-c05-actions02-workflow.yaml new file mode 100644 index 0000000..b0c0c0a --- /dev/null +++ b/.github/workflows/vishaalpal-c05-actions02-workflow.yaml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/vishaalpal-gh-actions-workflow.yaml b/.github/workflows/vishaalpal-gh-actions-workflow.yaml new file mode 100644 index 0000000..969bcad --- /dev/null +++ b/.github/workflows/vishaalpal-gh-actions-workflow.yaml @@ -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 }} diff --git a/vishaalpal/README.md b/vishaalpal/README.md new file mode 100644 index 0000000..7fe715d --- /dev/null +++ b/vishaalpal/README.md @@ -0,0 +1 @@ +This is a README file for exercise c05-actions01 by vishaalpal. diff --git a/vishaalpal/c05-actions02/Dockerfile b/vishaalpal/c05-actions02/Dockerfile new file mode 100644 index 0000000..eafda86 --- /dev/null +++ b/vishaalpal/c05-actions02/Dockerfile @@ -0,0 +1,2 @@ +FROM httpd:2.4.41 +RUN echo "This is my GH actions exercise v2." > /usr/local/apache2/htdocs/index.html diff --git a/vishaalpal/c05-actions02/Makefile b/vishaalpal/c05-actions02/Makefile new file mode 100644 index 0000000..da9020f --- /dev/null +++ b/vishaalpal/c05-actions02/Makefile @@ -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) \ No newline at end of file diff --git a/vishaalpal/c05-actions02/README.md b/vishaalpal/c05-actions02/README.md new file mode 100644 index 0000000..25f81c1 --- /dev/null +++ b/vishaalpal/c05-actions02/README.md @@ -0,0 +1 @@ +This is a README file for exercise c05-actions02 by vishaalpal. diff --git a/vishaalpal/c05-actions02/docker-compose.yaml b/vishaalpal/c05-actions02/docker-compose.yaml new file mode 100644 index 0000000..c110cba --- /dev/null +++ b/vishaalpal/c05-actions02/docker-compose.yaml @@ -0,0 +1,5 @@ +version: '3.8' +services: + web: + image: ${IMAGE_NAME}:${SC_SHA} + build: . diff --git a/vishaalpal/c05-actions02/vishaalpal-c05-actions02-workflow.yaml b/vishaalpal/c05-actions02/vishaalpal-c05-actions02-workflow.yaml new file mode 100644 index 0000000..b0c0c0a --- /dev/null +++ b/vishaalpal/c05-actions02/vishaalpal-c05-actions02-workflow.yaml @@ -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 }} \ No newline at end of file diff --git a/vishaalpal/c05-actions02/vishaalpal-gh-actions-workflow.yaml b/vishaalpal/c05-actions02/vishaalpal-gh-actions-workflow.yaml new file mode 100644 index 0000000..969bcad --- /dev/null +++ b/vishaalpal/c05-actions02/vishaalpal-gh-actions-workflow.yaml @@ -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 }}