generated from devopsacademyau/projects-template
-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (37 loc) · 1.21 KB
/
lgothelipe-c05-actions02.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: lgothelipe-c05-actions02
on:
pull_request:
paths:
- lgothelipe/**
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ 'c05-image' }}
steps:
- uses: actions/checkout@v2
- name: Variable
run: echo ${{ github.sha }} | tail -c 7 > SHORT_SHA
- name: Build the Docker image
run: docker build -t $IMAGE_NAME:$(cat SHORT_SHA) -f lgothelipe/c05-actions02/Dockerfile .
- name: Log into docker hub
run: docker login -u ${{ secrets.LG_DOCKER_USERNAME }} -p ${{ secrets.LG_DOCKER_PASSWORD }}
- name: Push image
run: |
docker tag $IMAGE_NAME:$(cat SHORT_SHA) ${{ secrets.LG_DOCKER_USERNAME }}/$IMAGE_NAME:$(cat SHORT_SHA)
docker push ${{ secrets.LG_DOCKER_USERNAME }}/$IMAGE_NAME:$(cat SHORT_SHA)
comment:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ 'c05-image' }}
SHA: ${{ github.sha }}
steps:
- uses: actions/checkout@v1
- name: Variable
run: |
echo Image name $IMAGE_NAME:${SHA: (-6)} > .github/workflows/comment.md
- uses: harupy/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.LG_GITHUB_TOKEN }}
with:
filename: comment.md