Skip to content

Merge pull request #4 from laineveeti/bugfixing #9

Merge pull request #4 from laineveeti/bugfixing

Merge pull request #4 from laineveeti/bugfixing #9

Workflow file for this run

name: Deployment pipeline
on:
pull_request:
branches:
- main
types: [opened, synchronize]
push:
branches:
- main
env:
COMMIT_MESSAGES: ${{ toJson(github.event.commits.*.message) }}
COMMIT: ${{ toJson(github.event.commits)[0] }}
SECRET: ${{ secrets.SECRET }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
TEST_MONGODB_URI: ${{ secrets.TEST_MONGODB_URI }}
DEV_MONGODB_URI: ${{ secrets.DEV_MONGODB_URI }}
jobs:
simple_deployment_pipeline:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install && cd frontend && npm install
- run: npm run eslint && cd frontend && npm run eslint
- run: npm run build
- run: npm run test
- name: frontend tests
run: cd frontend && npm run test
- name: e2e tests
uses: cypress-io/github-action@v5
with:
command: cd frontend && npm run cypress
start: npm run start
wait-on: http://localhost:5000
- name: deployment
if: ${{ github.event_name == 'push' }}
run: curl https://api.render.com/deploy/srv-${{ secrets.RENDER_SERVICE_ID }}?key=${{ secrets.RENDER_API_KEY }}
- name: Success
uses: rjstone/discord-webhook-notify@v1
if: ${{ github.event_name == 'push' && success() }}
with:
severity: info
text: A new version of Bloglist App deployed
details: 'to https://full-stack-open-pokedex-pupa.onrender.com/'
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Failure
uses: rjstone/discord-webhook-notify@v1
if: ${{ github.event_name == 'push' && failure() }}
with:
severity: error
text: Build failed!
details: ${{ format('commit {0} by {1} broke the build :((', env.COMMIT.url, env.COMMIT.author.name) }}
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
tag_release:
needs: [simple_deployment_pipeline]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Bump version and push tag
if: ${{ github.event_name == 'push' && !contains(join(env.COMMIT_MESSAGES, ', '), '#skip')}}
uses: anothrNick/github-tag-action@8c8163ef62cf9c4677c8e800f36270af27930f42
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch