mirror of
https://github.com/hexastack/hexabot
synced 2025-04-27 17:51:58 +00:00
feat: optimize workflow
This commit is contained in:
parent
b5468f81ee
commit
eb3f53d787
91
.github/workflows/merge.yml
vendored
91
.github/workflows/merge.yml
vendored
@ -1,8 +1,8 @@
|
|||||||
name: Build and Push Docker Image On Merge
|
name: Build and Push Docker Image On Merge
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ['main']
|
branches: ['main']
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -21,91 +21,58 @@ jobs:
|
|||||||
filters: |
|
filters: |
|
||||||
frontend:
|
frontend:
|
||||||
- 'frontend/**'
|
- 'frontend/**'
|
||||||
api:
|
api:
|
||||||
- 'api/**'
|
- 'api/**'
|
||||||
widget:
|
widget:
|
||||||
- 'widget/**'
|
- 'widget/**'
|
||||||
|
|
||||||
frontend-build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ needs.paths-filter.outputs.frontend == 'true' }}
|
needs:
|
||||||
|
- paths-filter
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code ...
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push docker image
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: ./frontend
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: hexastack/hexabot-frontend:latest
|
|
||||||
|
|
||||||
api-build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: ${{ needs.paths-filter.outputs.api == 'true' }}
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code ...
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
id: docker_login
|
||||||
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push docker image
|
- name: Build and push frontend Docker image
|
||||||
id: docker_build
|
if: ${{ needs.paths-filter.outputs.frontend == 'true' }}
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./api
|
context: ./
|
||||||
|
file: ./frontend/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: hexastack/hexabot-api:latest
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-frontend:latest
|
||||||
|
|
||||||
widget-build-and-push:
|
- name: Build and push API Docker image
|
||||||
runs-on: ubuntu-latest
|
if: ${{ needs.paths-filter.outputs.api == 'true' }}
|
||||||
if: ${{ needs.paths-filter.outputs.widget == 'true' }}
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code ...
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push docker image
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./widget
|
context: ./
|
||||||
|
file: ./api/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: hexastack/hexabot-widget:latest
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-api:latest
|
||||||
|
|
||||||
|
- name: Build and push widget Docker image
|
||||||
|
if: ${{ needs.paths-filter.outputs.widget == 'true' }}
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./
|
||||||
|
file: ./widget/Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hexabot-widget:latest
|
||||||
|
Loading…
Reference in New Issue
Block a user