Skip to content

Merge pull request #42 from NCAR/workflows #22

Merge pull request #42 from NCAR/workflows

Merge pull request #42 from NCAR/workflows #22

Workflow file for this run

name: Build and Deploy Docker Image
on:
push:
branches:
- main
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: false
tags: ghcr.io/ncar/chemistry-cafe:build-temp
- name: Build and push Docker image (latest)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ghcr.io/ncar/chemistry-cafe:latest
- name: Build and push Docker image (tagged)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ghcr.io/ncar/chemistry-cafe:${{ github.ref_name }}