Create Docker image on new release or using manual trigger #14
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 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 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 }}" | |
echo ${{ secrets.TOKEN_FOR_ACTIONS }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
docker buildx build --platform linux/amd64,linux/arm64 --file docker/Dockerfile --tag $IMAGE_NAME:$IMAGE_TAG --push . | |
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV | |
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' |