Skip to content

Commit 4cd3b03

Browse files
committed
New github action for week3 and week4
1 parent 74c44df commit 4cd3b03

File tree

3 files changed

+5
-45
lines changed

3 files changed

+5
-45
lines changed

.github/workflows/docker-build-push.yml

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,28 @@ on:
66
- 'Learn/week3/**'
77
- 'Learn/week4/**'
88
- 'Learn/week5/**'
9-
workflow_dispatch:
10-
inputs:
11-
directory:
12-
description: 'Select the directory (week) to build and push'
13-
required: true
14-
type: choice
15-
options:
16-
- week3
17-
- week4
18-
- week5
19-
- all
20-
image_tag:
21-
description: 'Tag for the Docker image (e.g., v1.0, latest)'
22-
required: true
23-
default: 'latest'
24-
type: string
259

2610
jobs:
2711
prepare:
2812
runs-on: ubuntu-latest
2913
outputs:
30-
directories: ${{ steps.set-dirs.outputs.directories }}
14+
directories: ${{ steps.filter.outputs.changes }}
3115
steps:
3216
- name: Checkout code
3317
uses: actions/checkout@v4
3418

3519
- name: Check changed directories
3620
id: filter
37-
if: github.event_name == 'push'
3821
uses: dorny/paths-filter@v3
3922
with:
4023
filters: |
4124
week3: 'Learn/week3/**'
4225
week4: 'Learn/week4/**'
4326
week5: 'Learn/week5/**'
4427
45-
- id: set-dirs
46-
run: |
47-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
48-
if [ "${{ github.event.inputs.directory }}" = "all" ]; then
49-
echo 'directories=["week3", "week4", "week5"]' >> $GITHUB_OUTPUT
50-
else
51-
echo 'directories=["${{ github.event.inputs.directory }}"]' >> $GITHUB_OUTPUT
52-
fi
53-
else
54-
# For push events, build array based on filter results
55-
DIRS=()
56-
if [ "${{ steps.filter.outputs.week3 }}" = "true" ]; then DIRS+=("\"week3\""); fi
57-
if [ "${{ steps.filter.outputs.week4 }}" = "true" ]; then DIRS+=("\"week4\""); fi
58-
if [ "${{ steps.filter.outputs.week5 }}" = "true" ]; then DIRS+=("\"week5\""); fi
59-
60-
# Join array with commas and wrap in brackets
61-
JSON_DIRS=$(IFS=,; echo "[${DIRS[*]}]")
62-
echo "directories=$JSON_DIRS" >> $GITHUB_OUTPUT
63-
fi
64-
6528
docker-build-push:
6629
needs: prepare
30+
if: needs.prepare.outputs.directories != '[]'
6731
runs-on: ubuntu-latest
6832
strategy:
6933
matrix:
@@ -90,11 +54,7 @@ jobs:
9054
id: prep
9155
run: |
9256
echo "OWNER_LOWERCASE=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_OUTPUT
93-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
94-
echo "IMAGE_TAG=${{ github.event.inputs.image_tag }}" >> $GITHUB_OUTPUT
95-
else
96-
echo "IMAGE_TAG=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
97-
fi
57+
echo "IMAGE_TAG=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
9858
9959
- name: Build and Push
10060
uses: docker/build-push-action@v6

Learn/week3/fastApi-intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
```bash
1616
# Open your terminal/command prompt
1717

18-
# Create a folder for your projects
18+
# Create a folder for your project
1919
mkdir my-first-api
2020
cd my-first-api
2121
```

Learn/week4/post-pydantic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_users():
3434
```
3535
GET /search?query=fastapi&limit=10
3636
37-
All data is in URL - anyone can see it!
37+
All data is in URL - anyone can see it!
3838
```
3939

4040
#### POST Requests (New!)

0 commit comments

Comments
 (0)