107 lines
3.1 KiB
YAML
107 lines
3.1 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
|
|
TAG: latest
|
|
REGISTRY_USER: eric@coissac.eu
|
|
IMAGE_REGISTRY: niepce.petite-maison-orange.fr
|
|
REGISTRY_PASSWORD: ${{ secrets.NIEPCETOKEN }}
|
|
CHECK: https://haoma.petite-maison-orange.fr/ping/814308c3-d90c-4511-b236-c40b37a5ad23
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Start the job
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
${{ env.CHECK }}/start
|
|
shell: bash
|
|
|
|
- name: install Buildah
|
|
run: |
|
|
apt-get install -y buildah
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build image starting
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
--data-raw "Buildind docker image for $(cat bluesky_crossposter_latest.txt)" \
|
|
${{ env.CHECK }}/log
|
|
shell: bash
|
|
|
|
- name: Set up Buildah
|
|
id: build-image
|
|
uses: redhat-actions/buildah-build@v2
|
|
with:
|
|
image: ${{ env.IMAGE_NAME }}
|
|
tags: latest ${{ github.sha }}
|
|
containerfiles: |
|
|
./Dockerfile
|
|
|
|
- name: Canceled building
|
|
if: cancelled()
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
--data-raw "Building image cancelled for $(cat bluesky_crossposter_latest.txt)" \
|
|
${{ env.CHECK }}/fail
|
|
exit 1
|
|
shell: bash
|
|
|
|
- name: Build image failed
|
|
if: failure()
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
--data-raw "Failed to build docker image for $(cat bluesky_crossposter_latest.txt)" \
|
|
${{ env.CHECK }}/fail
|
|
exit 1
|
|
shell: bash
|
|
|
|
- name: Log in to Niepce Docker Registry
|
|
uses: redhat-actions/podman-login@v1
|
|
with:
|
|
registry: ${{ env.IMAGE_REGISTRY }}
|
|
username: ${{ env.REGISTRY_USER }}
|
|
password: ${{ env.REGISTRY_PASSWORD }}
|
|
|
|
- name: Push to GitHub Container Repository
|
|
id: push-to-niepce
|
|
uses: redhat-actions/push-to-registry@v2
|
|
with:
|
|
image: ${{ steps.build-image.outputs.image }}
|
|
tags: ${{ steps.build-image.outputs.tags }}
|
|
registry: ${{ env.IMAGE_REGISTRY }}
|
|
|
|
- name: Push image failed
|
|
if: failure()
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
--data-raw "Failed to push docker image for $(cat bluesky_crossposter_latest.txt)" \
|
|
${{ env.CHECK }}/fail
|
|
exit 1
|
|
shell: bash
|
|
|
|
- name: End of the job
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
--data-raw "Build docker image for $(cat bluesky_crossposter_latest.txt)" \
|
|
${{ env.CHECK }}
|
|
shell: bash
|
|
- name: Canceled building
|
|
if: cancelled()
|
|
run: |
|
|
curl -fsS -m 10 --retry 5 \
|
|
--data-raw "Building image cancelled for $(cat bluesky_crossposter_latest.txt)" \
|
|
${{ env.CHECK }}/fail
|
|
exit 1
|
|
shell: bash
|
|
|
|
|