Skip to content

Commit 3d61ce9

Browse files
committed
Bootcamp update 5th and 6th editions
1 parent 729e78e commit 3d61ce9

File tree

19 files changed

+344
-125
lines changed

19 files changed

+344
-125
lines changed

.github/workflows/cd-docker.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
# runs-on: ubuntu-latest
1313

1414
# steps:
15-
# - uses: actions/checkout@v4
16-
# - uses: actions/setup-node@v4
15+
# - uses: actions/checkout@v6
16+
# - uses: actions/setup-node@v6
1717
# with:
1818
# node-version: 16
1919
# cache: 'npm'
@@ -23,7 +23,7 @@ jobs:
2323
# run: |
2424
# npm ci
2525
# npm run build --if-present
26-
# - uses: actions/upload-artifact@v3
26+
# - uses: actions/upload-artifact@v6
2727
# with:
2828
# name: build-code
2929
# path: hangman-api/dist/
@@ -33,15 +33,15 @@ jobs:
3333
needs: build
3434

3535
steps:
36-
- uses: actions/checkout@v4
37-
- uses: actions/download-artifact@v3
36+
- uses: actions/checkout@v6
37+
- uses: actions/download-artifact@v7
3838
with:
3939
name: build-code
4040
path: hangman-api/dist/
4141
- name: Build and Push Docker Image
4242
working-directory: ./hangman-api
4343
env:
44-
DOCKER_USER: "jaimesalas"
44+
DOCKER_USER: "jaimesalas" # <your-docker-username>
4545
DOCKER_REPOSITORY: "hangman-api"
4646
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
4747
run: |
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docker Image hangman API CD (using Docker actions)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v6
12+
- uses: actions/setup-node@v6
13+
with:
14+
node-version: 16
15+
cache: 'npm'
16+
cache-dependency-path: hangman-api/package-lock.json
17+
- name: build
18+
working-directory: ./hangman-api
19+
run: |
20+
npm ci
21+
npm run build --if-present
22+
- uses: actions/upload-artifact@v6
23+
with:
24+
name: build-code
25+
path: hangman-api/dist/
26+
27+
# delivery:
28+
# runs-on: ubuntu-latest
29+
# needs: build
30+
31+
# steps:
32+
# - uses: actions/checkout@v6
33+
# - uses: actions/download-artifact@v7
34+
# with:
35+
# name: build-code
36+
# path: hangman-api/dist/
37+
# - name: Build and Push Docker Image
38+
# working-directory: ./hangman-api
39+
# env:
40+
# DOCKER_USER: "jaimesalas" # <your-docker-username>
41+
# DOCKER_REPOSITORY: "hangman-api"
42+
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
43+
# run: |
44+
# echo $DOCKER_PASSWORD | docker login --username $DOCKER_USER --password-stdin
45+
# image=$DOCKER_USER/$DOCKER_REPOSITORY:$(date +%s)
46+
# docker build -t $image -f Dockerfile.workflow .
47+
# docker push $image
48+
49+
delivery:
50+
runs-on: ubuntu-latest
51+
needs: build
52+
53+
steps:
54+
- name: Checkout repo
55+
uses: actions/checkout@v6
56+
- name: Download dist folder as artifact
57+
uses: actions/download-artifact@v7
58+
- name: Docker Hub login
59+
uses: docker/login-action@v3
60+
with:
61+
# registry: by default is set to Docker Hub
62+
username: jtrillo # <your_docker_username>
63+
password: ${{ secrets.DOCKER_PASSWORD }}
64+
- name: Set up Docker Buildx
65+
uses: docker/setup-buildx-action@v3
66+
- name: Build and push Docker Image
67+
uses: docker/build-push-action@v6
68+
with:
69+
context: ./hangman-api
70+
push: true
71+
tags: jtrillo/hangman-api-actions:latest # <your_docker_username>
72+
file: ./hangman-api/Dockerfile.workflow

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88

99
pull_request:
1010
branches: [main]
11-
paths: ["hangman-api/**"]
11+
# paths: ["hangman-api/**"]
1212

1313
jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/setup-node@v4
18+
- uses: actions/checkout@v6
19+
- uses: actions/setup-node@v6
2020
with:
2121
node-version: 16
2222
cache: "npm"
@@ -32,8 +32,8 @@ jobs:
3232
needs: build
3333

3434
steps:
35-
- uses: actions/checkout@v4
36-
- uses: actions/setup-node@v4
35+
- uses: actions/checkout@v6
36+
- uses: actions/setup-node@v6
3737
with:
3838
node-version: 16
3939
- name: test
@@ -63,8 +63,8 @@ jobs:
6363
- 5432:5432
6464

6565
steps:
66-
- uses: actions/checkout@v4
67-
- uses: actions/setup-node@v4
66+
- uses: actions/checkout@v6
67+
- uses: actions/setup-node@v6
6868
with:
6969
node-version: 16
7070
# - name: Create database relationships

.github/workflows/reusable-node-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/setup-node@v4
18+
- uses: actions/checkout@v6
19+
- uses: actions/setup-node@v6
2020
with:
2121
node-version: ${{ inputs.node-version }}
2222
cache: "npm"
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
npm ci
2828
npm run build --if-present
29-
- uses: actions/upload-artifact@v3
29+
- uses: actions/upload-artifact@v6
3030
with:
3131
name: build-code
3232
path: ${{ inputs.working-directory }}/dist/

.github/workflows/test-custom-action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
uses: jtrillo/get-commodity-price@v1.0.1
1414
with:
1515
commodity: silver
16+
currency: EUR
1617
# Use the output from 'commodity_price' step
1718
- name: Get the output price
18-
run: echo "Price per ounce is ${{ steps.commodity_price.outputs.price }} USD"
19+
run: echo "Price per ounce is ${{ steps.commodity_price.outputs.price }} ${{ steps.commodity_price.inputs.currency }}"

.start-code/hangman-api/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ ENV NODE_ENV=production
2323

2424
RUN npm install
2525

26-
27-
CMD ["npm", "start"]
26+
CMD ["npm", "start"]

01-setup-ci/readme.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ jobs:
3131
whoami
3232
pwd
3333
node -v
34-
35-
3634
```
3735
3836
Let's commit this file to a new branch:
@@ -84,7 +82,7 @@ jobs:
8482

8583
steps:
8684
+ - name: Checkout # This field is optional
87-
+ - uses: actions/checkout@v4
85+
+ - uses: actions/checkout@v6
8886
- name: inspect
8987
run: |
9088
ls -al
@@ -94,7 +92,7 @@ jobs:
9492

9593
```
9694

97-
Recall that on job steps we can use an action or run a command. Here we're using an action `actions/checkout@v4` that needs no further configuration.
95+
Recall that on job steps we can use an action or run a command. Here we're using an action `actions/checkout@v6` that needs no further configuration.
9896

9997
```bash
10098
git add .
@@ -142,14 +140,13 @@ jobs:
142140
- runs-on: ubuntu-latest
143141

144142
- steps:
145-
- - uses: actions/checkout@v4
143+
- - uses: actions/checkout@v6
146144
- - name: inspect
147145
- run: |
148146
- ls -al
149147
- whoami
150148
- pwd
151149
- node -v
152-
153150
```
154151

155152
```yaml
@@ -167,7 +164,7 @@ jobs:
167164
runs-on: ubuntu-latest
168165

169166
steps:
170-
- uses: actions/checkout@v4
167+
- uses: actions/checkout@v6
171168
- name: build and test
172169
working-directory: ./hangman-api
173170
run: |
@@ -204,15 +201,13 @@ jobs:
204201
runs-on: ubuntu-latest
205202

206203
steps:
207-
- uses: actions/checkout@v4
204+
- uses: actions/checkout@v6
208205
- name: build and test
209206
working-directory: ./hangman-api
210207
run: |
211208
npm ci
212209
npm run build --if-present
213-
ls ./dist
214210
npm test
215-
216211
```
217212

218213
* With `paths` we filter the directories that are able to trigger a new workflow.

02-multiple-target-environments/readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
node-version: [16, 17, 18]
3939
# diff #
4040
steps:
41-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@v6
4242
- name: build and test
4343
working-directory: ./hangman-api
4444
run: |
@@ -60,10 +60,10 @@ jobs:
6060
node-version: [16, 17, 18]
6161

6262
steps:
63-
- uses: actions/checkout@v4
63+
- uses: actions/checkout@v6
6464
# diff #
6565
- name: Setup Node.js environment
66-
uses: actions/setup-node@v4
66+
uses: actions/setup-node@v6
6767
with:
6868
node-version: ${{ matrix.node-version }}
6969
# diff #
@@ -132,9 +132,9 @@ jobs:
132132
+ os: [ubuntu-20.04, ubuntu-22.04]
133133
+ runs-on: ${{ matrix.os }}
134134
steps:
135-
- uses: actions/checkout@v4
135+
- uses: actions/checkout@v6
136136
- name: Setup Node.js environment
137-
uses: actions/setup-node@v4
137+
uses: actions/setup-node@v6
138138
with:
139139
node-version: ${{ matrix.node-version }}
140140
- name: build and test

03-running-multiple-jobs/readme.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444
- runs-on: ${{ matrix.os }}
4545

4646
steps:
47-
- uses: actions/checkout@v4
47+
- uses: actions/checkout@v6
4848
- - name: Setup Node.js environment
49-
- uses: actions/setup-node@v4
49+
- uses: actions/setup-node@v6
5050
- with:
5151
- node-version: ${{ matrix.node-version }}
5252
- name: build and test
@@ -68,7 +68,7 @@ jobs:
6868
runs-on: ubuntu-latest
6969

7070
steps:
71-
- uses: actions/checkout@v4
71+
- uses: actions/checkout@v6
7272
- - name: build and test
7373
+ - name: build
7474
working-directory: ./hangman-api
@@ -98,7 +98,7 @@ jobs:
9898
runs-on: ubuntu-latest
9999

100100
steps:
101-
- uses: actions/checkout@v4
101+
- uses: actions/checkout@v6
102102
- name: build
103103
working-directory: ./hangman-api
104104
run: |
@@ -109,7 +109,7 @@ jobs:
109109
runs-on: ubuntu-latest
110110

111111
steps:
112-
- uses: actions/checkout@v4
112+
- uses: actions/checkout@v6
113113
- name: test
114114
working-directory: ./hangman-api
115115
run: |
@@ -188,7 +188,7 @@ jobs:
188188
runs-on: ubuntu-latest
189189

190190
steps:
191-
- uses: actions/checkout@v4
191+
- uses: actions/checkout@v6
192192
- name: build
193193
working-directory: ./hangman-api
194194
run: |
@@ -199,7 +199,7 @@ jobs:
199199
runs-on: ubuntu-latest
200200
+ needs: build # If it depends on more than one, use an array
201201
steps:
202-
- uses: actions/checkout@v4
202+
- uses: actions/checkout@v6
203203
- name: test
204204
working-directory: ./hangman-api
205205
run: |

0 commit comments

Comments
 (0)