mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 03:30:25 -05:00
67 lines
1.9 KiB
YAML
67 lines
1.9 KiB
YAML
name: Build and Publish Docker Image
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
release:
|
|
types: [published]
|
|
push:
|
|
branches:
|
|
- develop
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
IMAGE_NAME:
|
|
- ppanel-user-web
|
|
- ppanel-admin-web
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract version from package.json
|
|
id: version
|
|
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
|
|
|
|
- name: Get short SHA
|
|
id: sha
|
|
run: echo "GIT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
|
|
|
|
- name: Build and push Docker image for main release
|
|
if: github.event_name == 'release'
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./docker/${{ matrix.IMAGE_NAME }}/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ secrets.DOCKER_USERNAME }}/${{ matrix.IMAGE_NAME }}:latest
|
|
${{ secrets.DOCKER_USERNAME }}/${{ matrix.IMAGE_NAME }}:${{ env.VERSION }}
|
|
|
|
- name: Build and push Docker image for develop
|
|
if: github.ref == 'refs/heads/develop'
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./docker/${{ matrix.IMAGE_NAME }}/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ secrets.DOCKER_USERNAME }}/${{ matrix.IMAGE_NAME }}:beta
|
|
${{ secrets.DOCKER_USERNAME }}/${{ matrix.IMAGE_NAME }}:${{ env.VERSION }}-${{ env.GIT_SHA }}-beta
|