Publish and Build Docker Image #27
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: Publish and Build Docker Image | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
TAG_NAME: | |
description: 'Tag name for test version' | |
required: true | |
env: | |
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Packages | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.DOCKER_ACTION_USER }} | |
password: ${{ secrets.DOCKER_ACTION_TOKEN }} | |
- name: Build and push on release | |
if: github.event_name == 'release' | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./docker/php/Dockerfile | |
context: . | |
push: true | |
tags: | | |
ghcr.io/rationai/xopat:${{ env.TAG_NAME }} | |
ghcr.io/rationai/xopat:latest | |
- name: Build and push on dispatch | |
if: github.event_name != 'release' | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./docker/php/Dockerfile | |
context: . | |
push: true | |
tags: | | |
ghcr.io/rationai/xopat:${{ env.TAG_NAME }} |