Git version (#1257) #776
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
# Comment comment comment | |
name: Docker Image Build & Push | |
on: | |
push: | |
# Runs on every push on master branch | |
branches: | |
- master | |
# Except when its just doc changes | |
paths-ignore: | |
- 'doc/**' | |
# Runs when a tag following semantic versioning is pushed | |
tags: | |
- v* | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: chaos-polymtl/lethe | |
CACHE_IMAGE_TAG: master | |
jobs: | |
docker: | |
name: Build & Push Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Docker Image Tags and Labels | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build & Push Docker Image | |
uses: docker/build-push-action@v2.7.0 | |
with: | |
push: true | |
# Cache from the registry's most recent image | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.CACHE_IMAGE_TAG }} | |
# Use generated tags and labels from the meta step | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |