Create frontend Docker image on new release or using manual trigger #46
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ./frontend | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' |