Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 7fdbfe1

Browse files
committed
wrap it up
1 parent e04926b commit 7fdbfe1

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

config.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,16 @@ steps:
267267
# We validate
268268
# - type: gate
269269

270-
# Step 11: Write the steps for the production workflow
270+
# Step 11: Create the Docker image and push it to GPR
271271

272272
# We tell the user to write the proper steps for the workflow
273273
- type: respond
274274
with: 11_workflow-steps.md
275275

276276
# event: commit, user writes the steps for the workflow, using recommended existing GitHub steps
277277

278-
- title: Write the steps for the production workflow
279-
description: Write the steps for the production deployment to the workflow file
278+
- title: Create the Docker image and push it to GPR
279+
description: Add a step to the workflow for building and pushing a Docker image to GPR.
280280
event: pull_request
281281
link: '{{ repoUrl }}/pull/3'
282282
actions:
@@ -306,12 +306,7 @@ steps:
306306

307307
# check that its merged
308308
- type: gate
309-
every: true
310-
gates:
311-
- left: '%payload.action%'
312-
operator: ===
313-
right: closed
314-
- left: '%payload.pull_request.merged%'
309+
left: '%payload.pull_request.merged%'
315310

316311
# final response: congratulations
317312
- type: respond

responses/11_workflow-steps.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,42 @@
11
# Workflow steps
22

3-
So far, the workflow knows what the trigger is and what environment to run in. But, what exactly is supposed to run? The "steps" section of this workflow specify what actions to be run in the Ubuntu environment when new labels are added.
3+
We'll add a final section to our production workflow that packages up our application in a Docker container and publishes it to the GitHub Package Registry (GPR). This step is important for the traceability of your deployed artifacts.
44

5-
With the staging deployment, we use `checkout` and `Deploy to AWS`. In this workflow, we use:
6-
7-
- `actions/checkout@v1`
8-
- `Deploy to AWS`
9-
10-
We also have a new section past the `deploy` section, called **Docker Build, Tag, Push**, or Build-and-Push-Docker-Image. This part of the workflow uses the action from another course. That action builds the code, tags the commit, and pushes a package to the GitHub Package Registry.
11-
12-
- `actions/checkout@v1`
13-
- `actions/download-artifact@master`
14-
- `mattdavis0351/actions/docker-gpr@v1`
5+
We'll only use one new action here created by a GitHubber, which allows us to push a container to GPR.
6+
- `mattdavis0351/actions/docker-gpr`
157

168
All of this happens automatically once a pull request is merged!
179

1810
## Step 11: Write the steps for the production workflow
1911

2012
### :keyboard: Activity: Write the steps for the production deployment workflow
2113

14+
1. Add a job to your workflow as follows:
15+
```yml
16+
Build-and-Push-Docker-Image:
17+
runs-on: ubuntu-latest
18+
needs: build
19+
name: Docker Build, Tag, Push
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v1
23+
24+
- name: Download built artifact
25+
uses: actions/download-artifact@master
26+
with:
27+
name: webpack artifacts
28+
path: public
29+
30+
- name: Build, Tag, Push
31+
uses: mattdavis0351/actions/docker-gpr@v1
32+
with:
33+
repo-token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
34+
image-name: tic-tac-toe
35+
```
36+
1. Commit the workflow to this branch.
37+
38+
The complete workflow file should look like this:
39+
2240
```yml
2341
name: Production deployment
2442

responses/12_congratulations.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## Nice work!
22

3+
Now, we just have to wait for the deployment to occur, and for the package to be published to GPR. When it's completed, you should be able to see it in the [Packages]({{ repoUrl }}/packages) section of your repository. You can get the deployment URL in the [Actions]({{ repoUrl }}/actions) log, just like the staging URL.
4+
35
![celebrate](https://octodex.github.com/images/jetpacktocat.png)
46

5-
You merged and this course is now complete! I'll stop responding but the fun doesn't have to stop here.
7+
This course is now complete! I'll stop responding but the fun doesn't have to stop here.
68

79
Now...[what will you learn next]({{ host }}/courses)?

0 commit comments

Comments
 (0)