Skip to content

Publish Auction Backend Docker Image #110

Publish Auction Backend Docker Image

Publish Auction Backend Docker Image #110

name: Publish Auction Backend Docker Image
on:
workflow_run:
workflows: [ Release Auction REST API ]
types:
- completed
branches:
- main
jobs:
publish:
name: Publish Auction Backend Docker Image
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: read
packages: write
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Set up JDK 17'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
architecture: 'x64'
- name: 'Build project with Maven'
run: |
mvn verify -DskipTests
- name: Get version
id: get_version
run: |
chmod +x get_version.sh
echo "version=$(./get_version.sh)" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: 'Publish Auction Database Docker Image'
working-directory: ${{ github.workspace }}/db
run: |
docker build . -t ghcr.io/phuuthanh-dev/auction-database:${{ steps.get_version.outputs.version }} -t ghcr.io/phuuthanh-dev/auction-database:latest
docker push ghcr.io/phuuthanh-dev/auction-database:${{ steps.get_version.outputs.version }}
docker push ghcr.io/phuuthanh-dev/auction-database:latest
- name: 'Publish Auction Backend Docker Image'
working-directory: ${{ github.workspace }}
run: |
docker build . -t ghcr.io/phuuthanh-dev/auction-api:${{ steps.get_version.outputs.version }} -t ghcr.io/phuuthanh-dev/auction-api:latest
docker push ghcr.io/phuuthanh-dev/auction-api:${{ steps.get_version.outputs.version }}
docker push ghcr.io/phuuthanh-dev/auction-api:latest