-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test the staging action #3
Conversation
Great! The syntax you used tells GitHub Actions to only run that workflow when a commit is made to the master branch. Deploying to productionJust like with the other workflow, we'll need to build our application and deploy to AWS using the same action as before because we are working with the same Continuous delivery is a concept that contains many behaviors and other, more specific concepts. One of those concepts is test in production. That can mean different things to different projects and different companies, and isn't a strict rule that says you are or aren't "doing CD". In our case, we can match our production environment to be exactly like our staging environment. This minimizes opportunities for surprises once we deploy to production. Step 9: Complete the deployment to production workflow⌨️ Commit the steps to the production workflow that allow you to deploy on merge to master
It should look like the file below when you are finished. Note that not much has changed from our staging workflow, except for our trigger. name: Production deployment
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: npm install and build webpack
run: |
npm install
npm run build
- uses: actions/upload-artifact@master
with:
name: webpack artifacts
path: public/
deploy:
name: Deploy Node.js app to AWS
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download built artifact
uses: actions/download-artifact@master
with:
name: webpack artifacts
path: public
- name: Deploy to AWS
uses: github/deploy-nodejs@master
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} |
@brianamarie At this point in the course, |
Workflow stepsWe'll add a final section to our production workflow that packages up our application in a Docker container and publishes it to GitHub Packages. This step is important for the traceability of your deployed artifacts. We'll only use one new action here created by a GitHubber, which allows us to push a container to GitHub Packages.
All of this happens automatically once a pull request is merged! Step 10: Create the Docker image and push it to GitHub Packages⌨️ Activity: Write the steps for the production deployment workflow
The complete workflow file should look like this: name: Production deployment
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: npm install and build webpack
run: |
npm install
npm run build
- uses: actions/upload-artifact@master
with:
name: webpack artifacts
path: public/
deploy:
name: Deploy Node.js app to AWS
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download built artifact
uses: actions/download-artifact@master
with:
name: webpack artifacts
path: public
- name: Deploy to AWS
uses: github/deploy-nodejs@master
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
Build-and-Push-Docker-Image:
runs-on: ubuntu-latest
needs: build
name: Docker Build, Tag, Push
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Download built artifact
uses: actions/download-artifact@master
with:
name: webpack artifacts
path: public
- name: Build, Tag, Push
uses: mattdavis0351/actions/docker-gpr@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
image-name: wpride-aws-ttt |
Completed WorkflowNice job, you've done it! Step 11: Merge the production workflow⌨️ Activity: Merge this pull request and test the production deployment workflow
|
Nice work!Now, we just have to wait for the deployment to occur, and for the package to be published to GitHub Packages. When it's completed, you should be able to see it in the Packages section of your repository. You can get the deployment URL in the Actions log, just like the staging URL. This course is now complete! I'll stop responding but the fun doesn't have to stop here. Now...what will you learn next? |
@brianamarie Other than that, flawless and incredibly helpful course! Thank you. |
Thanks! I will open an issue in the course repo so we can look into this. githubtraining/continuous-delivery-aws#30 |
Testing the workflow
Now that the proper configuration and workflow files are present, let's test this action out!
Step 7: Test the staging action
In this pull request, there's a small change to the game. Once you add the label, you should be able to see the deployment!
⌨️ Activity: Add the proper label to this pull request