mirror of
https://github.com/joaovitoriasilva/endurain.git
synced 2026-01-08 23:38:01 -05:00
45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: Create frontend Docker image on new release or using manual trigger
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
release:
|
|
types:
|
|
- created
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Create a builder
|
|
run: |
|
|
docker buildx create --use
|
|
|
|
- name: Build and push the frontend Docker image
|
|
run: |
|
|
if [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then
|
|
IMAGE_TAG="dev_$(date +"%d%m%Y")"
|
|
else
|
|
IMAGE_TAG="${{ github.event.release.tag_name }}"
|
|
fi
|
|
IMAGE_NAME="ghcr.io/${{ github.repository }}/frontend"
|
|
|
|
echo ${{ secrets.TOKEN_FOR_ACTIONS }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
|
|
|
docker buildx build --platform linux/amd64,linux/arm64 --file frontend/Dockerfile --tag $IMAGE_NAME:$IMAGE_TAG --push .
|
|
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
|
|
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|