Skip to content

Build and Publish Docker Image #38

Build and Publish Docker Image

Build and Publish Docker Image #38

Workflow file for this run

name: Build and Publish Docker Image
on:
workflow_run:
workflows: ["Build & Test"]
types:
- completed
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract version from file
id: extract-version
run: |
VERSION=$(cat VERSION)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and tag Docker image
run: |
docker build -t shahen/famcache .
docker tag shahen/famcache:latest shahen/famcache:${{ env.VERSION }}
- name: Push Docker image
run: |
docker push shahen/famcache:latest
docker push shahen/famcache:${{ env.VERSION }}