Skip to content

Commit 8ab3ec7

Browse files
committed
Changes for v1.3.3
1 parent 4915cfa commit 8ab3ec7

File tree

8 files changed

+123
-104
lines changed

8 files changed

+123
-104
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ jobs:
2222
GITHUB_REPOSITORY: ${{ github.repository }}
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424
run: ./build.bash -p
25+
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: Buildscript
29+
path: package/buildscript-*.zip
30+
if-no-files-found: ignore
31+

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [1.3.3] - 2025-10-09
9+
10+
- Revert broken build changes
11+
- Improve release-prep.bash and release-publish.bash scripts
12+
- Change to manual deployment method
13+
- Revise and streamline Dockerfile
14+
- Add copy of release-publish script to Dockerfile
915

1016
## [1.3.2] - 2025-09-17
1117

@@ -49,7 +55,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4955
- GitHub workflow `build.yml` to show how to call the script as a GitHub Action
5056

5157
[unreleased]: https://github.com/mcld/buildscript/compare/v1.3.0...HEAD
52-
[1.2.0]: https://github.com/mcld/buildscript/compare/v1.2.0...v1.3.0
58+
[1.3.3]: https://github.com/mcld/buildscript/compare/v1.3.2...v1.3.3
59+
[1.3.2]: https://github.com/mcld/buildscript/compare/v1.3.0...v1.3.2
60+
[1.3.0]: https://github.com/mcld/buildscript/compare/v1.2.0...v1.3.0
5361
[1.2.0]: https://github.com/mcld/buildscript/compare/v1.1.0...v1.2.0
5462
[1.1.0]: https://github.com/mcld/buildscript/compare/v1.0.1...v1.1.0
5563
[1.0.1]: https://github.com/mcld/buildscript/compare/v1.0.0...v1.0.1

Dockerfile

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,60 @@
1-
# prepare base image
2-
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
1+
# Get build image
2+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
3+
34
WORKDIR /app
45

5-
# get build image
6-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
7-
WORKDIR /src
6+
# Copy source
7+
COPY . ./
8+
9+
# Bring in metadata via --build-arg for build
10+
ARG IMAGE_VERSION=unknown
811

9-
# run dotnet restore
10-
COPY ["buildscript/buildscript.csproj", "buildscript/"]
11-
RUN dotnet restore "buildscript/buildscript.csproj"
12+
# Restore packages
13+
RUN dotnet restore
1214

13-
# copy source and build
14-
COPY . .
15-
WORKDIR "/src/buildscript"
16-
RUN dotnet build "buildscript.csproj" -c Release -o /app/build
15+
# Build project and run tests
16+
RUN dotnet test -v m /property:WarningLevel=0
1717

18-
# create publish image
19-
FROM build AS publish
20-
RUN dotnet publish "buildscript.csproj" -c Release -o /app/publish
18+
# Publish release project
19+
RUN dotnet publish -v m /property:WarningLevel=0 -c Release --property:PublishDir=/app/publish/
20+
21+
# Copy release-publish.bash script
22+
RUN cp /app/release-publish.bash "/app/publish/"
23+
24+
# Copy actual build script
25+
RUN cp /app/build.bash "/app/publish/"
26+
27+
# Get runtime image
28+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS publish
2129

22-
# copy published app to final
23-
FROM base AS final
2430
WORKDIR /app
2531

26-
# Bring in metadata via --build-arg
32+
# Bring in metadata via --build-arg to publish
2733
ARG BRANCH=unknown
2834
ARG IMAGE_CREATED=unknown
2935
ARG IMAGE_REVISION=unknown
3036
ARG IMAGE_VERSION=unknown
3137

3238
# Configure image labels
33-
LABEL branch=$branch \
34-
maintainer="Maricopa County Library District developers <[email protected]>" \
35-
org.opencontainers.image.authors="Maricopa County Library District developers <[email protected]>" \
36-
org.opencontainers.image.created=$IMAGE_CREATED \
37-
org.opencontainers.image.description="Build script test project" \
38-
org.opencontainers.image.licenses="MIT" \
39-
org.opencontainers.image.revision=$IMAGE_REVISION \
40-
org.opencontainers.image.source="https://github.com/MCLD/buildscript" \
41-
org.opencontainers.image.title="Build script test project" \
42-
org.opencontainers.image.vendor="Maricopa County Library District" \
43-
org.opencontainers.image.version=$IMAGE_VERSION
39+
LABEL branch=$BRANCH \
40+
maintainer="Maricopa County Library District developers <[email protected]>" \
41+
org.opencontainers.image.authors="Maricopa County Library District developers <[email protected]>" \
42+
org.opencontainers.image.created=$IMAGE_CREATED \
43+
org.opencontainers.image.description="Build script test project" \
44+
org.opencontainers.image.licenses="MIT" \
45+
org.opencontainers.image.revision=$IMAGE_REVISION \
46+
org.opencontainers.image.source="https://github.com/MCLD/buildscript" \
47+
org.opencontainers.image.title="Build scrip test project" \
48+
org.opencontainers.image.vendor="Maricopa County Library District" \
49+
org.opencontainers.image.version=$IMAGE_VERSION
4450

4551
# Default image environment variable settings
4652
ENV org.opencontainers.image.created=$IMAGE_CREATED \
47-
org.opencontainers.image.revision=$IMAGE_REVISION \
48-
org.opencontainers.image.version=$IMAGE_VERSION
53+
org.opencontainers.image.revision=$IMAGE_REVISION \
54+
org.opencontainers.image.version=$IMAGE_VERSION
55+
56+
# Copy source
57+
COPY --from=build "/app/publish/" .
4958

50-
COPY --from=publish /app/publish .
59+
# Set entrypoint
5160
ENTRYPOINT ["dotnet", "buildscript.dll"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Options (all are optional):
2424
- `-h, --help` - Print this help and exit
2525
- `-v, --verbose` - Print script debug info
2626
- `-df, --dockerfile` - Use the specified Dockerfile
27-
- `-p, --publish` - Run the release-publish.bash script in the container (if it's present)
27+
- `-p, --publish` - Run the release-prep and (in container) release-publish scripts (if present)
2828
- `Docker tag` - Override the guessed Docker tag (the current directory) with this value if present
2929

3030
Environment variables (all are optional):

build.bash

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Available options:
2323
-h, --help Print this help and exit
2424
-v, --verbose Print script debug info
2525
-df, --dockerfile Use the specified Dockerfile
26-
-p, --publish Run the release-publish.bash script in the container (if it's present)
26+
--no-color Do not use color codes in script output
27+
-p, --publish Run release-prep.bash and (in container) release-publish.bash (if present)
2728
2829
Environment variables:
2930
@@ -38,7 +39,7 @@ Environment variables:
3839
- GHCR_PAT - optional - GitHub Container Registry Personal Access Token
3940
- GHCR_USER - optional - username to log in to the GitHub Container Registry
4041
41-
Version 1.3.2 released 2025-09-17
42+
Version 1.3.3 released 2025-10-09
4243
EOF
4344
exit
4445
}
@@ -116,7 +117,7 @@ readonly SYSARCH
116117

117118
if [[ ${SYSARCH} = "i386" ]]; then
118119
readonly ARCH="x86_32"
119-
elif [[ ${SYSARCH} = "aarch64" ]]; then
120+
elif [[ ${SYSARCH} = "aarch64" ]]; then
120121
readonly ARCH="armv7"
121122
else
122123
readonly ARCH=${SYSARCH}
@@ -162,11 +163,11 @@ fi
162163
if [[ $BLD_BRANCH = "develop"
163164
|| $BLD_BRANCH = "main"
164165
|| $BLD_BRANCH = "master"
165-
|| $BLD_BRANCH = "test" ]]; then
166+
|| $BLD_BRANCH = "test" ]]; then
166167
BLD_DOCKER_TAG=$BLD_BRANCH
167168
BLD_VERSION=${BLD_BRANCH}-${BLD_VERSION_DATE}
168169
BLD_PUSH=true
169-
elif [[ "$BLD_BRANCH" =~ release/([0-9]+\.[0-9]+\.[0-9]+.*) ]]; then
170+
elif [[ "$BLD_BRANCH" =~ release/([0-9]+\.[0-9]+\.[0-9]+.*) ]]; then
170171
BLD_RELEASE_VERSION=${BASH_REMATCH[1]}
171172
BLD_DOCKER_TAG=v${BLD_RELEASE_VERSION}
172173
BLD_VERSION=v${BLD_RELEASE_VERSION}
@@ -202,7 +203,7 @@ fi
202203
if [[ $BLD_RELEASE = "true" && -x "release-prep.bash" ]]; then
203204
msg "${BLUE}===${NOFORMAT} Running release preparation for version $BLD_RELEASE_VERSION"
204205
#shellcheck disable=SC1091
205-
./release-prep.bash
206+
source release-prep.bash
206207
msg "${GREEN}===${NOFORMAT} Release preparation script complete"
207208
fi
208209

@@ -311,15 +312,13 @@ if [[ $BLD_PUSH = true ]]; then
311312
--entrypoint "/app/release-publish.bash" \
312313
--env-file release.env \
313314
-e BLD_RELEASE_VERSION="$BLD_RELEASE_VERSION" \
314-
-v "${PWD}/:/app" \
315315
-v "${PWD}/package:/package" \
316316
"$BLD_FULL_DOCKER_IMAGE"
317317
else
318318
docker run -i \
319319
--rm \
320320
--entrypoint "/app/release-publish.bash" \
321321
-e BLD_RELEASE_VERSION="$BLD_RELEASE_VERSION" \
322-
-v "${PWD}/:/app" \
323322
-v "${PWD}/package:/package" \
324323
"$BLD_FULL_DOCKER_IMAGE"
325324
fi

buildscript.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
.gitignore = .gitignore
1111
azure-pipelines.yml = azure-pipelines.yml
1212
build.bash = build.bash
13+
CHANGELOG.md = CHANGELOG.md
1314
.github\workflows\ci.yml = .github\workflows\ci.yml
1415
Dockerfile = Dockerfile
16+
LICENSE.md = LICENSE.md
1517
README.md = README.md
1618
release-prep.bash = release-prep.bash
1719
release-publish.bash = release-publish.bash

release-prep.bash

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,75 @@ script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
77

88
usage() {
99
cat <<EOF
10-
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
10+
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v]
1111
12-
Fake release prep script.
12+
Pre-build release preparation script
1313
1414
Available options:
1515
1616
-h, --help Print this help and exit
17+
--no-color Do not use color codes in script output
18+
-p Perform publish steps
1719
-v, --verbose Print script debug info
1820
EOF
19-
exit
21+
exit
2022
}
2123

2224
cleanup() {
23-
trap - SIGINT SIGTERM ERR EXIT
24-
# script cleanup here
25+
trap - SIGINT SIGTERM ERR EXIT
26+
# script cleanup here
2527
}
2628

2729
setup_colors() {
28-
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
29-
NOFORMAT='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
30-
else
31-
NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
32-
fi
30+
if [[ -t 2 ]] && [[ -z "${NO_COLOR-}" ]] && [[ "${TERM-}" != "dumb" ]]; then
31+
NOFORMAT='\033[0m' RED='\033[0;31m' GREEN='\033[0;32m' ORANGE='\033[0;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' YELLOW='\033[1;33m'
32+
else
33+
NOFORMAT='' RED='' GREEN='' ORANGE='' BLUE='' PURPLE='' CYAN='' YELLOW=''
34+
fi
3335
}
3436

3537
msg() {
36-
echo >&2 -e "${1-}"
38+
echo >&2 -e "${1-}"
3739
}
3840

3941
die() {
40-
local msg=$1
41-
local code=${2-1} # default exit status 1
42-
msg "$msg"
43-
exit "$code"
42+
local msg=$1
43+
local code=${2-1} # default exit status 1
44+
msg "$msg"
45+
exit "$code"
4446
}
4547

4648
parse_params() {
47-
# default values of variables set from params
48-
flag=0
49-
param=''
50-
51-
while :; do
52-
case "${1-}" in
53-
-h | --help) usage ;;
54-
-v | --verbose) set -x ;;
55-
--no-color) NO_COLOR=1 ;;
56-
-?*) die "Unknown option: $1" ;;
57-
*) break ;;
58-
esac
59-
shift
60-
done
61-
62-
args=("$@")
63-
64-
return 0
49+
# default values of variables set from params
50+
publish=0
51+
52+
while :; do
53+
case "${1-}" in
54+
-h | --help) usage ;;
55+
-v | --verbose) set -x ;;
56+
--no-color) NO_COLOR=1 ;;
57+
-p | --publish) publish=1 ;;
58+
-?*) die "Unknown option: $1" ;;
59+
*) break ;;
60+
esac
61+
shift
62+
done
63+
64+
return 0
6565
}
6666

6767
parse_params "$@"
6868
setup_colors
6969

7070
# script logic here
7171

72-
msg "... release-prep.bash is preparing for release"
73-
sleep 2
74-
msg "... release-prep.bash has prepared for release."
72+
readonly PUB_STARTAT=$SECONDS
73+
74+
if [[ publish -eq 1 ]]; then
75+
msg "${BLUE}===${NOFORMAT} Performing publish release prep"
76+
sleep 2
77+
msg "${PURPLE}===${NOFORMAT} Release prep successful in $((SECONDS - PUB_STARTAT)) seconds."
78+
else
79+
msg "${RED}===${NOFORMAT} Missing -p flag, not running release prep"
80+
fi
81+

release-publish.bash

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ usage() {
99
cat <<EOF
1010
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
1111
12-
Script description here.
12+
Post-build release processing script
1313
1414
Available options:
1515
1616
-h, --help Print this help and exit
17+
--no-color Do not use color codes in script output
1718
-v, --verbose Print script debug info
1819
EOF
1920
exit
@@ -63,34 +64,20 @@ parse_params() {
6364
parse_params "$@"
6465
setup_colors
6566

66-
readonly BLD_PUBLISH_DIRECTORY=buildscript-${BLD_RELEASE_VERSION-}
67+
#script logic here
6768

68-
msg "=== Installing necessary packages"
69-
apt update && apt install build-essential zip -y
69+
readonly PUB_STARTAT=$SECONDS
7070

71-
cd /
71+
msg "${BLUE}===${NOFORMAT} Installing zip package"
7272

73-
msg "=== Making directory ${BLD_PUBLISH_DIRECTORY-}"
74-
mkdir -p "${BLD_PUBLISH_DIRECTORY-}"
73+
apt-get update && apt-get install zip -y
7574

76-
msg "=== Copying files into ${BLD_PUBLISH_DIRECTORY-}"
77-
cp -a app/* "${BLD_PUBLISH_DIRECTORY-}"
75+
msg "${BLUE}===${NOFORMAT} Publishing to buildscript-${BLD_RELEASE_VERSION}.zip"
7876

79-
msg "=== Compressing files"
80-
zip -q -r9 "buildscript-${BLD_RELEASE_VERSION-}.zip" "${BLD_PUBLISH_DIRECTORY-}"/
77+
mkdir -p "/package" && \
78+
cd /app && \
79+
zip -q -r9 "/package/buildscript-${BLD_RELEASE_VERSION}.zip" "build.bash" && \
80+
du -sh "/package/buildscript-${BLD_RELEASE_VERSION}.zip"
8181

82-
du -sch "${BLD_PUBLISH_DIRECTORY-}"/ "buildscript-${BLD_RELEASE_VERSION-}.zip"
82+
msg "${PURPLE}===${NOFORMAT} Publish script complete in $((SECONDS - PUB_STARTAT)) seconds."
8383

84-
if [[ -n "${BLD_RELEASE_TOKEN-}" ]]; then
85-
curl -L -O https://github.com/tfausak/github-release/releases/latest/download/github-release-linux.gz
86-
gunzip github-release-linux.gz && chmod 700 github-release-linux && \
87-
./github-release-linux upload \
88-
--token "${BLD_RELEASE_TOKEN-}" \
89-
--owner "${BLD_RELEASE_OWNER-}" \
90-
--repo "${BLD_RELEASE_REPO-}" \
91-
--tag "v${BLD_RELEASE_VERSION-}" \
92-
--file "buildscript-${BLD_RELEASE_VERSION-}.zip" \
93-
--name "buildscript-${BLD_RELEASE_VERSION-}.zip"
94-
else
95-
echo "=== No BLD_RELEASE_TOKEN configured, not pushing release artifacts to GitHub Releases"
96-
fi

0 commit comments

Comments
 (0)