|
1 | 1 | # Workflow steps |
2 | 2 |
|
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. |
4 | 4 |
|
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` |
15 | 7 |
|
16 | 8 | All of this happens automatically once a pull request is merged! |
17 | 9 |
|
18 | 10 | ## Step 11: Write the steps for the production workflow |
19 | 11 |
|
20 | 12 | ### :keyboard: Activity: Write the steps for the production deployment workflow |
21 | 13 |
|
| 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 | +
|
22 | 40 | ```yml |
23 | 41 | name: Production deployment |
24 | 42 |
|
|
0 commit comments