add healthcheck workflow #11
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: Deployment pipeline | |
env: | |
SHOULD_DEPLOY: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message), '#skip') }} | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize] | |
jobs: | |
simple_deployment_pipeline: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Install dependencies for backend | |
run: npm ci | |
- name: Lint backend | |
run: npm run lint:backend | |
- name: Test backend | |
run: npm run test:backend | |
- name: Install dependencies for frontend | |
run: npm run install:frontend | |
- name: Check style for frontend | |
run: npm run lint:frontend | |
- name: Build for frontend | |
run: npm run build:frontend | |
- name: Test for frontend | |
run: npm run test:frontend | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: e2e tests | |
run: npm run test:e2e | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Deploy app | |
if: ${{ env.SHOULD_DEPLOY == 'true' }} | |
run: flyctl deploy --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Notify Discord on success | |
if: ${{ success() && env.SHOULD_DEPLOY == 'true' }} | |
uses: stegzilla/discord-notify@v2 | |
with: | |
title: redux-anecdotes-ci deployment succeeded! | |
message: "**${{ github.event.head_commit.message }}**\n**Creator:** ${{ github.event.head_commit.author.username }}\n${{ github.event.head_commit.url }}" | |
webhook_url: ${{ secrets.DISCORD_WEBHOOK }} | |
username: 'devserkan' | |
colour: '#1f883d' | |
- name: Notify Discord on failure | |
if: ${{ failure() && env.SHOULD_DEPLOY == 'true' }} | |
uses: stegzilla/discord-notify@v2 | |
with: | |
title: redux-anecdotes-ci deployment failed! | |
message: "**${{ github.event.head_commit.message }}**\n**Creator:** ${{ github.event.head_commit.author.username }}\n${{ github.event.head_commit.url }}" | |
webhook_url: ${{ secrets.DISCORD_WEBHOOK }} | |
username: 'devserkan' | |
colour: '#d73a49' | |
tag_release: | |
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message), '#skip') }} | |
needs: [simple_deployment_pipeline] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Bump version and push tag | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: patch |