Skip to content

Fix annoying wrong ref #19

Fix annoying wrong ref

Fix annoying wrong ref #19

Workflow file for this run

name: Publish Docker Image on GHCR - GitHub Container Registry
on:
push:
tags: [ 'v*.*.*' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_BASE_NAME: fluidos-energy-predictor
ORG_NAME: ${{ github.repository_owner }}
BASE_BRANCH: ${{ github.ref }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set running Git tag
run: echo "GIT_TAG=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Set last version Git tag
run: echo "VERSION=$(git describe --tags --always --abbrev=0)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:fluidos, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.GIT_TAG }} , ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}
clean:
name: Clean up unused images
needs: build
runs-on: ubuntu-latest
steps:
- name: Delete non-release images
uses: snok/container-retention-policy@v2
with:
image-names: ${{ env.IMAGE_BASE_NAME }}
cut-off: 20 minutes ago UTC
account-type: org
org-name: ${{ env.ORG_NAME }}
keep-at-least: 3
skip-tags: ${{ env.BASE_BRANCH }} , ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
token-type: github-token