mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-19 16:28:42 +00:00
57 lines
1.7 KiB
YAML
57 lines
1.7 KiB
YAML
name: Build & Push Docker Images
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
install: true
|
|
|
|
- name: Log in to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract version from release tag
|
|
if: github.event_name == 'release'
|
|
id: version
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
|
|
- name: Build and push Docker image (latest)
|
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
|
run: |
|
|
docker buildx create --use
|
|
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
|
--cache-from=type=registry,ref=itzcrazykns1337/perplexica:latest \
|
|
--cache-to=type=inline \
|
|
-f docker/Dockerfile \
|
|
-t itzcrazykns1337/perplexica:latest \
|
|
--push .
|
|
|
|
- name: Build and push Docker image (release)
|
|
if: github.event_name == 'release'
|
|
run: |
|
|
docker buildx create --use
|
|
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
|
--cache-from=type=registry,ref=itzcrazykns1337/perplexica:${{ env.RELEASE_VERSION }} \
|
|
--cache-to=type=inline \
|
|
-f docker/Dockerfile \
|
|
-t itzcrazykns1337/perplexica:${{ env.RELEASE_VERSION }} \
|
|
--push .
|