82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
name: Docker Hub Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Versión del release'
|
|
required: false
|
|
default: '0.1.0-rc1'
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, arm64]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set version tag
|
|
id: version
|
|
run: |
|
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
|
else
|
|
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Build and Push Docker Image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/${{ matrix.arch }}
|
|
push: true
|
|
tags: |
|
|
diocrafts/oxicloud:${{ env.VERSION }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
build-args: |
|
|
VERSION=${{ env.VERSION }}
|
|
|
|
# Crear el manifiesto multi-arch una vez todas las imágenes estén listas
|
|
manifest:
|
|
needs: build-and-push
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set version tag
|
|
run: |
|
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
|
|
else
|
|
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Create and Push Manifest
|
|
run: |
|
|
docker buildx imagetools create \
|
|
-t diocrafts/oxicloud:${{ env.VERSION }} \
|
|
diocrafts/oxicloud:${{ env.VERSION }}@linux/amd64 \
|
|
diocrafts/oxicloud:${{ env.VERSION }}@linux/arm64
|