Test Dockerfile, add Dockerfile changes to release notes (#850)

pull/852/head
Michele Locati 2023-12-14 16:14:09 +01:00 committed by GitHub
parent 5f97821813
commit 9129367b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 1 deletions

View File

@ -82,6 +82,7 @@ jobs:
for CHANGED_FILE in $(git diff --name-only "refs/tags/$VERSIONTAG_LAST" HEAD); do for CHANGED_FILE in $(git diff --name-only "refs/tags/$VERSIONTAG_LAST" HEAD); do
case "$CHANGED_FILE" in case "$CHANGED_FILE" in
install-php-extensions) install-php-extensions)
Dockerfile)
CREATE_TAG=y CREATE_TAG=y
;; ;;
esac esac
@ -143,7 +144,7 @@ jobs:
RELEASE_NOTES='First version' RELEASE_NOTES='First version'
else else
printf 'Generating release notes for commits between %s and %s\n' "$VERSIONTAG_PREVIOUS" "$VERSIONTAG_THIS" printf 'Generating release notes for commits between %s and %s\n' "$VERSIONTAG_PREVIOUS" "$VERSIONTAG_THIS"
RELEASE_NOTES="$(git log --format='- %s' --no-merges --reverse "refs/tags/$VERSIONTAG_PREVIOUS...refs/tags/$VERSIONTAG_THIS" -- ./install-php-extensions | grep -vE '^- \[minor\]')" RELEASE_NOTES="$(git log --format='- %s' --no-merges --reverse "refs/tags/$VERSIONTAG_PREVIOUS...refs/tags/$VERSIONTAG_THIS" -- ./install-php-extensions ./Dockerfile | grep -vE '^- \[minor\]')"
fi fi
printf 'Release notes:\n%s\n' "$RELEASE_NOTES" printf 'Release notes:\n%s\n' "$RELEASE_NOTES"
printf 'RELEASE_NAME=v%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV" printf 'RELEASE_NAME=v%s\n' "$VERSIONTAG_THIS" >> "$GITHUB_ENV"

38
.github/workflows/test-dockerfile.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Build Docker image
on:
pull_request:
paths:
- Dockerfile
- .github/workflows/test-dockerfile.yml
jobs:
build:
name: Build Docker image
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Build image
run: docker build --tag test:latest .
-
name: Save image contents
run: docker save --output /tmp/image.tar test:latest
-
name: Extract layer
run: tar -C /tmp -x -f /tmp/image.tar --wildcards '*layer.tar' --strip-components=1
-
name: Check layer contents
run: |
ENTRY="$(tar -v -t -f /tmp/layer.tar --wildcards '*bin/install-php-extensions')"
if [ -z "$ENTRY" ]; then
echo 'File not found'
exit 1
fi
if ! printf '%s' "$ENTRY" | grep -E '^.r.xr.xr.x '; then
printf 'Invalid entry permissions:\n%s\n' "$ENTRY"
exit 1
fi
echo 'Entry is correct.'