Skip to content

Commit

Permalink
Feature: Add powershell 7.4 images
Browse files Browse the repository at this point in the history
  • Loading branch information
joeltimothyoh committed Mar 4, 2024
1 parent 5cf2823 commit 154c8e6
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
PS_VERSION: [7.1.4, 7.1.5, 7.2.0, 7.2.1, 7.2.2, 7.3]
PS_VERSION: [7.1.4, 7.1.5, 7.2.0, 7.2.1, 7.2.2, 7.3, 7.4]
OS: [alpine]
OS_VARIANT: ['3.11', '3.12', '3.13', '3.14', '3.15', '3.16', '3.17']
TOOL_VARIANT: [git, git-sudo]
Expand Down Expand Up @@ -149,6 +149,21 @@ jobs:
- PS_VERSION: 7.3
OS: alpine
OS_VARIANT: '3.12'
- PS_VERSION: 7.4
OS: alpine
OS_VARIANT: '3.11'
- PS_VERSION: 7.4
OS: alpine
OS_VARIANT: '3.12'
- PS_VERSION: 7.4
OS: alpine
OS_VARIANT: '3.13'
- PS_VERSION: 7.4
OS: alpine
OS_VARIANT: '3.14'
- PS_VERSION: 7.4
OS: alpine
OS_VARIANT: '3.15'
env:
PS_VERSION: ${{ matrix.PS_VERSION }}
OS: ${{ matrix.OS }}
Expand Down Expand Up @@ -201,6 +216,12 @@ jobs:
export BASE_TAG_FULL_REGEX=$( echo "$BASE_TAG_FULL" | rev | sed -rn 's/^-*(.+)/\1/p' | rev )
echo "BASE_TAG_FULL_REGEX: $BASE_TAG_FULL_REGEX"
time docker pull "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" || true
PS_VERSION_TRUNC=$( echo $PS_VERSION | sed -rn 's/([0-9]\.[0-9]).*/\1/p' )
# Get full PS version for 7.3 images
if [ 1 -eq "$( echo "$PS_VERSION_TRUNC >= 7.3" | bc )" ]; then
PS_VERSION_FULL=$( docker run -t --rm --entrypoint pwsh "${BASE_REGISTRY_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" -c '$PSVersionTable.PSVersion.ToString()' )
echo "PS_VERSION_FULL: $PS_VERSION_FULL"
fi
time docker build \
--cache-from "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" \
-t "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" \
Expand All @@ -210,6 +231,9 @@ jobs:
if [ "${TAG_LATEST}" = 'true' ]; then
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:latest"
fi
if [ 1 -eq "$( echo "$PS_VERSION_TRUNC >= 7.3" | bc )" ]; then
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${PS_VERSION_FULL}-${OS}-${OS_VARIANT}-${TOOL_VARIANT}"
fi
docker images
docker inspect "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}"
# Set job variables for later steps
Expand All @@ -226,7 +250,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
PS_VERSION: [7.1.4, 7.1.5, 7.2.0, 7.2.1, 7.2.2, 7.3]
PS_VERSION: [7.1.4, 7.1.5, 7.2.0, 7.2.1, 7.2.2, 7.3, 7.4]
OS: [ubuntu]
OS_VARIANT: [18.04, 20.04, 22.04]
TOOL_VARIANT: [git, git-sudo]
Expand Down Expand Up @@ -273,7 +297,7 @@ jobs:
OS_VARIANT: 20.04
ARCHIVE: 20220318
# Build image default tagging
- PS_VERSION: 7.3
- PS_VERSION: 7.4
OS: ubuntu
OS_VARIANT: 22.04
TOOL_VARIANT: git
Expand All @@ -298,6 +322,9 @@ jobs:
- PS_VERSION: 7.3
OS: ubuntu
OS_VARIANT: '18.04'
- PS_VERSION: 7.4
OS: ubuntu
OS_VARIANT: '18.04'
env:
PS_VERSION: ${{ matrix.PS_VERSION }}
OS: ${{ matrix.OS }}
Expand Down Expand Up @@ -350,6 +377,12 @@ jobs:
export BASE_TAG_FULL_REGEX=$( echo "$BASE_TAG_FULL" | rev | sed -rn 's/^-*(.+)/\1/p' | rev )
echo "BASE_TAG_FULL_REGEX: $BASE_TAG_FULL_REGEX"
time docker pull "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" || true
PS_VERSION_TRUNC=$( echo $PS_VERSION | sed -rn 's/([0-9]\.[0-9]).*/\1/p' )
# Get full PS version for 7.3 images
if [ 1 -eq "$( echo "$PS_VERSION_TRUNC >= 7.3" | bc )" ]; then
PS_VERSION_FULL=$( docker run -t --rm --entrypoint pwsh "${BASE_REGISTRY_NAMESPACE}/${BASE_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" -c '$PSVersionTable.PSVersion.ToString()' )
echo "PS_VERSION_FULL: $PS_VERSION_FULL"
fi
time docker build \
--cache-from "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" \
-t "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" \
Expand All @@ -359,6 +392,9 @@ jobs:
if [ "${TAG_LATEST}" = 'true' ]; then
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:latest"
fi
if [ 1 -eq "$( echo "$PS_VERSION_TRUNC >= 7.3" | bc )" ]; then
docker tag "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}" "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${PS_VERSION_FULL}-${OS}-${OS_VARIANT}-${TOOL_VARIANT}"
fi
docker images
docker inspect "${BUILD_REGISTRY_NAMESPACE}/${BUILD_IMAGE_NAME}:${BASE_TAG_FULL_REGEX}"
# Set job variables for later steps
Expand Down

0 comments on commit 154c8e6

Please sign in to comment.