Files
blueskycrossposter/.gitea/workflows/build-push.yaml
Eric Coissac 9ac43595b8
Some checks failed
Check BlueSky Crossposter version / check-version (push) Successful in 15s
Build and Push Docker Image / build (push) Failing after 5s
Actualiser .gitea/workflows/build-push.yaml
2025-04-14 10:16:59 +02:00

131 lines
4.5 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches:
- main # Changez cela si votre branche principale a un autre nom
env:
IMAGE_NAME: public/blueskycrossposter
IMAGE_TAGS: latest
IMAGE_REGISTRY: niepce.petite-maison-orange.fr
REGISTRY_USER: eric@coissac.eu
REGISTRY_PASSWORD: ${{ secrets.NIEPCETOKEN }}
CHECK: https://haoma.petite-maison-orange.fr/ping/814308c3-d90c-4511-b236-c40b37a5ad23
RELEASE_FILE: bluesky_crossposter_latest.txt
CHECK_SERVER: https://haoma.petite-maison-orange.fr
CHECK_UUID: 814308c3-d90c-4511-b236-c40b37a5ad23
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Start the job
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
server: ${{ env.CHECK_SERVER }}
uuid: ${{ env.CHECK_UUID }}
command: start
message: 'Starting job for image ${{ env.IMAGE_NAME }}'
- name: install podman
run: |
apt-get update
apt-get install -y podman
- name: Checkout code
uses: actions/checkout@v4
- name: Build image starting
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: ${{ env.CHECK_SERVER }}
check_uuid: ${{ env.CHECK_UUID }}
check_command: log
check_message: 'Buildind docker image for $(cat ${{ env.RELEASE_FILE }})'
- name: Read version file
id: version
run: |
# Lire le contenu du fichier et supprimer les espaces/retours chariots
SOFTVERSION=$(cat ${{ env.RELEASE_FILE }} | tr -d ' \n')
# Stocker la valeur dans une variable d'environnement
echo "SOFTVERSION=$SOFTVERSION" >> $GITEA_ENV
- name: Add PMO version tag
run: |
echo "IMAGE_TAGS=${{ env.IMAGE_TAGS }} pmo-${{ env.SOFTVERSION }}" >> $GITEA_ENV
- name: Podman login
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/podman-login@main
- name: Build and tag image
run: |
tags=(${{ env.IMAGE_TAGS }})
sep=""
if [[ -n "${tags[0]}" ]] ; then
sep=":"
fi
image=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}${sep}${tags[0]}
docker build -t ${image} .
docker save ${image} -o image.tar
podman load -i image.tar
for tag in "${tags[@]:1}" ; do
podman tag ${image} \
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${tag}
done
- name: Canceled building
if: cancelled()
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: ${{ env.CHECK_SERVER }}
check_uuid: ${{ env.CHECK_UUID }}
check_command: fail
check_message: 'Building image cancelled for $(cat ${{ env.RELEASE_FILE }})'
- name: Build image failed
if: failure()
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: ${{ env.CHECK_SERVER }}
check_uuid: ${{ env.CHECK_UUID }}
check_command: fail
check_message: 'Failed to build docker image for $(cat ${{ env.RELEASE_FILE }})'
- name: Image built and tagged
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: ${{ env.CHECK_SERVER }}
check_uuid: ${{ env.CHECK_UUID }}
check_command: log
check_message: 'Docker image for $(cat ${{ env.RELEASE_FILE }}) built and tagged'
- name: Push image to registry
run: |
tags=(${{ env.IMAGE_TAGS }})
for tag in "${tags[@]}" ; do
podman push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:$tag
done
- name: Push image failed
if: failure()
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: ${{ env.CHECK_SERVER }}
check_uuid: ${{ env.CHECK_UUID }}
check_command: fail
check_message: 'Failed to push docker image for $(cat ${{ env.RELEASE_FILE }})'
- name: End of the image building
uses: https://gargoton.petite-maison-orange.fr/pmo-actions/healthchecks-ping@main
with:
check_server: ${{ env.CHECK_SERVER }}
check_uuid: ${{ env.CHECK_UUID }}
check_command: stop
check_message: 'Docker image for $(cat ${{ env.RELEASE_FILE }}): task done'