diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 7a1e0d2..06efdc8 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -63,10 +63,15 @@ jobs: with: ref: ${{ github.event.workflow_run.head_sha || github.sha }} persist-credentials: false + # Tout l'historique et les tags, pour lire la version (git describe) + fetch-depth: 0 - - name: Short commit + # Version lisible dans le label OCI (#207) : 1.5.9 sur un tag, 1.5.9-11-gd5f9da6 sur main après la 1.5.9 + - name: Short commit and version id: commit - run: echo "sha=$(git rev-parse --short=7 HEAD)" >> "$GITHUB_OUTPUT" + run: | + echo "sha=$(git rev-parse --short=7 HEAD)" >> "$GITHUB_OUTPUT" + echo "version=$(git describe --tags --match 'v*' | sed 's/^v//')" >> "$GITHUB_OUTPUT" - uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0 @@ -89,6 +94,7 @@ jobs: type=raw,value=latest,enable=${{ github.event_name == 'workflow_run' }} type=raw,value=sha-${{ steps.commit.outputs.sha }} labels: | + org.opencontainers.image.version=${{ steps.commit.outputs.version }} org.opencontainers.image.revision=${{ github.event.workflow_run.head_sha || github.sha }} org.opencontainers.image.licenses=PolyForm-Noncommercial-1.0.0