ci: Включил ci/cd для фронта
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 5s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 3s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 5s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 8s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Failing after 14s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 3s
This commit is contained in:
@@ -6,7 +6,7 @@ on:
|
||||
|
||||
env:
|
||||
BACKEND_PATH: backend
|
||||
# FRONTEND_PATH: frontend
|
||||
FRONTEND_PATH: frontend
|
||||
SERVER_DOMAIN: ${{ gitea.server_url.replace('https://', '') }}
|
||||
|
||||
jobs:
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
outputs:
|
||||
backend_changed: ${{ steps.backend-changed.outputs.backend }}
|
||||
# frontend_changed: ${{ steps.frontend-changed.outputs.frontend }}
|
||||
frontend_changed: ${{ steps.frontend-changed.outputs.frontend }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
@@ -29,13 +29,13 @@ jobs:
|
||||
backend:
|
||||
- '${{ env.BACKEND_PATH }}/**'
|
||||
|
||||
# - name: Check for frontend changes
|
||||
# id: frontend-changed
|
||||
# uses: dorny/paths-filter@v2
|
||||
# with:
|
||||
# filters: |
|
||||
# frontend:
|
||||
# - '${{ env.FRONTEND_PATH }}/**'
|
||||
- name: Check for frontend changes
|
||||
id: frontend-changed
|
||||
uses: dorny/paths-filter@v2
|
||||
with:
|
||||
filters: |
|
||||
frontend:
|
||||
- '${{ env.FRONTEND_PATH }}/**'
|
||||
|
||||
backend:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -72,45 +72,44 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
# frontend:
|
||||
# runs-on: ubuntu-latest
|
||||
# name: Build & publish frontend image
|
||||
# container: catthehacker/ubuntu:act-latest
|
||||
# needs: [detect-changes]
|
||||
# if: ${{ needs.detect-changes.outputs.frontend_changed == 'true' }}
|
||||
# permissions:
|
||||
# contents: read
|
||||
# packages: write
|
||||
frontend:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build & publish frontend image
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
needs: [detect-changes]
|
||||
if: ${{ needs.detect-changes.outputs.frontend_changed == 'true' }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# uses: actions/checkout@v3
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# - name: Log in to the Container registry
|
||||
# uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||
# with:
|
||||
# registry: ${{ vars.SERVER_DOMAIN }}
|
||||
# username: ${{ gitea.actor }}
|
||||
# password: ${{ secrets.TOKEN }}
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||
with:
|
||||
registry: ${{ vars.SERVER_DOMAIN }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
|
||||
# - name: Extract metadata (tags, labels) for Docker
|
||||
# id: meta
|
||||
# uses: https://github.com/docker/metadata-action@v4
|
||||
# with:
|
||||
# images: ${{ vars.SERVER_DOMAIN }}/${{ gitea.repository }}/frontend
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ vars.SERVER_DOMAIN }}/${{ gitea.repository }}/frontend
|
||||
|
||||
# - name: Build and push Docker image
|
||||
# uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||
# with:
|
||||
# context: ./${{ env.FRONTEND_PATH }}
|
||||
# push: true
|
||||
# tags: ${{ steps.meta.outputs.tags }}
|
||||
# labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||
with:
|
||||
context: ./${{ env.FRONTEND_PATH }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
# needs: [frontend, backend]
|
||||
needs: [backend]
|
||||
needs: [frontend, backend]
|
||||
# always() - костыль для того, чтобы деплой выполнялся даже если один из билдов пропущен
|
||||
if: github.ref == 'refs/heads/dev' && always() && (needs.backend.result == 'success' || needs.frontend.result == 'success')
|
||||
name: Update stack on Portainer
|
||||
|
||||
Reference in New Issue
Block a user