try checking registry

This commit is contained in:
Jean-Christian Denis 2024-12-03 00:40:27 +01:00
parent 6581639086
commit c565047f5c
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -24,7 +24,7 @@ jobs:
contents: read
outputs:
version: ${{ steps.dotclear.outputs.version }}
exists: ${{ steps.repository.outputs.exists }}
exists: ${{ steps.container.outputs.image_exists }}
steps:
- name: Download and parse last version
id: dotclear
@ -33,48 +33,26 @@ jobs:
curl -fsSL -o versions.xml ${{ env.DOTCLEAR_URL }}
echo version=$(cat versions.xml | xq -x "//release[@name='${{ env.DOTCLEAR_CANAL }}']/@version") >> $GITHUB_OUTPUT
- name: Check repository releases
id: repository
uses: mukunku/tag-exists-action@v1.6.0
with:
tag: ${{ steps.dotclear.outputs.version }}
- name: Check registry image
id: container
uses: k4kratik/container-image-check-custom-action@v4
with:
type: dockerhub
container_repo_name: ${{ env.DOCKER_NAMESPACE }}/${{ env.DOTCLEAR_IMAGE }}
image_tag: ${{ steps.dotclear..outputs.version }}
dockerhub_username: ${{ secrets.DOCKER_USERNAME }}
dockerhub_token: ${{ secrets.DOCKER_TOKEN }}
- name: notfound
if: (steps.repository.outputs.exists == 'false')
if: (steps.container.outputs.image_exists == 'false')
run: |
SUMMARY=$'${{ github.repository }} repository tag ${{ steps.dotclear.outputs.version }} not found.\nLaunching next job.'
SUMMARY=$'Image ${{ env.DOCKER_NAMESPACE }}/${{ env.DOTCLEAR_IMAGE }}:${{ steps.dotclear..outputs.version }} not found.'
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY
- name: found
if: (steps.repository.outputs.exists == 'true')
if: (steps.container.outputs.image_exists == 'true')
run: |
SUMMARY=$'${{ github.repository }} repository tag ${{ steps.dotclear.outputs.version }} found.\nStopping workflow.'
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY
do_release:
needs: check_release
if: (needs.check_release.outputs.exists == 'false')
name: Create repository release according to Dotclear version
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Create repository release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.check_release.outputs.version }}
tag_name: ${{ needs.check_release.outputs.version }}
body: Source for docker image of Dotclear ${{ needs.check_release.outputs.version }} stable
draft: false
prerelease: false
- name: summary
run: |
SUMMARY=$'Release ${{ steps.dotclear.outputs.version }} created.\n${{ steps.create_release.outputs.url }}'
SUMMARY=$'Image ${{ env.DOCKER_NAMESPACE }}/${{ env.DOTCLEAR_IMAGE }}:${{ steps.dotclear..outputs.version }} found.'
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY
do_image: