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: check_server: ${{ env.CHECK_SERVER }} check_uuid: ${{ env.CHECK_UUID }} check_command: start check_message: 'Starting job for image ${{ env.IMAGE_NAME }}' - name: install podman run: | apt-get update apt-get install -y podman - name: Checkout and get version id: get_version uses: https://gargoton.petite-maison-orange.fr/pmo-actions/software-version@main with: git_checkout: true version_file: ${{ env.RELEASE_FILE }} - 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 ${{ steps.get_version.outputs.version }}' - name: Add PMO version tag run: | echo "IMAGE_TAGS=${{ env.IMAGE_TAGS }} pmo-${{ steps.get_version.outputs.version }}" >> $GITEA_ENV - name: Build and tag image uses: https://gargoton.petite-maison-orange.fr/pmo-actions/build-image@main with: image_name: '${{ env.IMAGE_NAME }}' image_tags: '${{ env.IMAGE_TAGS }}' debug: true - 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 uses: https://gargoton.petite-maison-orange.fr/pmo-actions/push-image@main with: registry_login: true image_name: '${{ env.IMAGE_NAME }}' image_tags: '${{ env.IMAGE_TAGS }}' - 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'