Skip to content

Commit 4cad17d

Browse files
Merge pull request #8 from aleyipsoftwire/exercise-9
Exercise 9
2 parents 32bd534 + aced5e7 commit 4cad17d

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

.github/workflows/my-pipeline.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,43 @@ name: Continuous Integration
33
on:
44
push:
55
paths-ignore:
6-
- 'ansible'
7-
- 'README.md'
6+
- "ansible"
7+
- "README.md"
88
pull_request:
99
paths-ignore:
10-
- 'ansible'
11-
- 'README.md'
10+
- "ansible"
11+
- "README.md"
1212

1313
jobs:
14-
build:
15-
name: Build and test
14+
test:
15+
name: Build docker image and run tests
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
1919
- run: docker build --target test --tag todo-app:test .
2020
- run: docker run --env-file .env.test todo-app:test
21+
22+
deploy:
23+
name: Build docker image and deploy to production
24+
runs-on: ubuntu-latest
25+
needs: test
26+
if: github.ref_name == github.event.repository.default_branch
27+
steps:
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
- name: Login to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: aleyipsoftwire
36+
password: ${{ secrets.DOCKER_HUB_PAT }}
37+
- name: Build and push
38+
uses: docker/build-push-action@v6
39+
with:
40+
push: true
41+
tags: aleyipsoftwire/todo-app:prod
42+
- name: Release to Azure
43+
env:
44+
AZURE_WEBHOOK: ${{ secrets.AZURE_WEBHOOK }}
45+
run: curl -X POST "$AZURE_WEBHOOK"

0 commit comments

Comments
 (0)