Skip to content

[feature] Exercise 11.18 #40

[feature] Exercise 11.18

[feature] Exercise 11.18 #40

Workflow file for this run

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: ${{ github.event_name == 'push' && success() }}
with:
severity: info
details: New version of Pokedex has been deployed!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Notify deploy failure
uses: rjstone/[email protected]
if: ${{ github.event_name == 'push' && failure() }}
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