[feature] Exercise 11.18 #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Trigger deployment pipeline | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize] | |
jobs: | |
deployment_pipeline: # Job naming | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 # Checkout the project source from Git | |
- uses: actions/setup-node@v3 # Set up to be able to use commands specified in package.json | |
with: | |
node-version: '16' | |
- name: Install dependencies # Install NodeJs dependencies | |
run: npm install | |
- name: Check style | |
run: npm run eslint | |
- name: Build | |
run: npm run build | |
- name: Run tests | |
run: npm run test | |
- name: Run E2E tests | |
uses: cypress-io/github-action@v5 # Use Cypress.io Github Action | |
with: | |
command: npm run test:e2e | |
start: npm run start-prod | |
wait-on: http://localhost:5000 # Before execute command, wait for start ecommand | |
- name: Deploying to Render | |
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '#skip') }} # Conditional step | |
run: curl https://api.render.com/deploy/srv-${{ secrets.RENDER_SERVICE_ID }}?key=${{ secrets.RENDER_API_KEY }} | |
- name: Notify deploy success | |
uses: rjstone/[email protected] | |
if: success() && ${{ github.event_name == 'push' }} | |
with: | |
severity: info | |
details: New version of Pokedex has been deployed! | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | |
- name: Notify deploy failure | |
uses: rjstone/[email protected] | |
if: failure() && ${{ github.event_name == 'push' }} | |
with: | |
severity: error | |
details: Couldn't deploy new version of Pokedex | |
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | |
tag_release: | |
needs: [deployment_pipeline] # Dependency on job completition | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 # Checkout the project source from Git | |
- name: Bump version and push tag | |
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '#skip') }} # Conditional step | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: patch |