mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-23 00:34:48 -06:00
fb5ff78c24
This includes some refactors to the build steps. High level items: * Add variables for DOCKER_IMAGE, S3_RELEASE_BUCKET to allow for forks of OPA to re-use the GitHub actions with their own s3 buckets and docker orgs/image names. * Unify the release build steps to use `make release` and the binaries being located under `_release/$(VERSION)`. All CI targets now rely on binaries being in that `RELEASE_DIR`, including image building steps The `make build` target is unaffected. * Add a wrapper to allow the CI to run the various golang target stages separately, but sharing the same docker configuration. * Conditionally specify `-it` for docker run commands based on whether A tty is available. * Added scripts to automate drafting a release with binary assets vi the `hub` CLI. * The release process triggered on a tag being pushed will now use the same binaries from `make release` for the docker images as well as the ones attached to the release (which are available under https://openpolicyagent.org/downloads/). The actions themselves are split into 3 workflows: pull-request.yaml: Triggers on pull requests. This will run all the normal tests/checks as before on Travis, however they are now split into separate jobs. In addition to what was done on Travis we will now have Codecov results included. post-merge.yaml: Triggers after a change is pushed to master. This will run tests and build+publish the `edge` and `dev` artifacts to dockerhub and s3. post-tag.yaml: Triggers after a tag has been pushed. Similar to post-merge.yaml it will run tests and build+publish release artifacts (for the tagged version). It will also create a draft release on GitHub with the same artifacts and notes from the CHANGELOG.md. If a release already exists it will be updated to include the assets, however the release notes will _not_ be added. The RELEASE.md steps have been updated and include notes on the new steps. Signed-off-by: Patrick East <east.patrick@gmail.com>
62 lines
1.2 KiB
Bash
Executable File
62 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
OPA_DIR=$(dirname "${BASH_SOURCE}")/..
|
|
CHANGELOG="${OPA_DIR}/CHANGELOG.md"
|
|
|
|
usage() {
|
|
echo "latest-release-notes.sh --output=<path>"
|
|
}
|
|
|
|
OUTPUT=""
|
|
|
|
for i in "$@"; do
|
|
case $i in
|
|
--output=*)
|
|
OUTPUT="${i#*=}"
|
|
shift
|
|
;;
|
|
*)
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "${OUTPUT}" ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
# Versions start with a h2 (## <semver>), find the latest two for start and stop
|
|
# positions in the CHANGELOG
|
|
LATEST_VERSION=$(grep '## [0-9]' "${CHANGELOG}" | head -n 1)
|
|
STOP_VERSION=$(grep '## [0-9]' "${CHANGELOG}" | head -n 2 | tail -n 1)
|
|
|
|
STARTED=false
|
|
|
|
while IFS= read -r line
|
|
do
|
|
# Skip lines until the first version header is found
|
|
if [[ "${STARTED}" == false ]]; then
|
|
if [[ "${line}" == "${LATEST_VERSION}" ]]; then
|
|
STARTED=true
|
|
fi
|
|
continue
|
|
fi
|
|
|
|
# Stop reading after we see the stopping point
|
|
if [[ "${line}" == "${STOP_VERSION}" ]]; then
|
|
break
|
|
fi
|
|
|
|
# Append each line between the two onto the release notes
|
|
echo -e "${line}" >> "${OUTPUT}"
|
|
|
|
done < "${CHANGELOG}"
|
|
|
|
# Delete all leading blank lines at top of file
|
|
sed -i.bak '/./,$!d' "${OUTPUT}"
|
|
rm "${OUTPUT}.bak"
|