Skip to content

chore(deps): lock file maintenance #379

chore(deps): lock file maintenance

chore(deps): lock file maintenance #379

name: deploy on production
on:
# Deploy only when pushed directly to the master
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
database: ${{ steps.filter.outputs.database }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
database:
- 'database/**'
frontend:
- 'src/**'
posts:
- 'posts/**'
build-frontend:
name: Build frontend
runs-on: ubuntu-latest
needs: changes
if: ${{ always() }}
permissions:
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/InCogNiTo124/personal-blog
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
build-db-server:
name: Build db-server
runs-on: ubuntu-latest
needs: changes
if: ${{ always() }}
permissions:
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/InCogNiTo124/personal-blog-server
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: database/
file: database/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-posts:
name: Build posts
runs-on: ubuntu-latest
needs:
- build-db-server
if: ${{ always() }}
permissions:
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/InCogNiTo124/personal-blog-db
tags: |
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: database/Dockerfile_posts
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
name: Deploy
runs-on: ubuntu-latest
needs:
- build-db-server
- build-posts
- build-frontend
steps:
- run: curl -X POST ${{ secrets.DEPLOY_WEBHOOK }}