Fix annoying wrong ref #28
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
name: Publish Docker image on FLUIDOS Docker Hub | |
on: | |
push: | |
branches: [ "fluidos" ] | |
tags: [ 'v*.*.*' ] | |
release: | |
types: [published] | |
env: | |
REGISTRY: docker.io | |
IMAGE_NAME: fluidos/energy-predictor | |
IMAGE_BASE_NAME: energy-predictor | |
ORG_NAME: fluidos | |
BASE_BRANCH: github | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if the repository is "fluidos/energy-predictor" | |
run: | | |
if [ "${{ github.repository }}" != "fluidos/energy-predictor" ]; then | |
echo "This workflow is only for the fluidos/energy-predictor repository." | |
exit 0 | |
fi | |
- 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 in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: fluidos | |
password: ${{ secrets.DOCKER_HUB_WRITE_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Push README to Docker Hub | |
uses: christian-korneck/update-container-description-action@v1 | |
env: | |
DOCKER_USER: fluidos | |
DOCKER_PASS: ${{ secrets.DOCKER_HUB_README_TOKEN }} | |
with: | |
destination_container_repo: fluidos/energy-predictor | |
provider: dockerhub | |
short_description: 'Predicting the energy and carbon demand of FLUIDOS nodes.' | |
readme_file: 'README.md' | |
- 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 }} | |