diff --git a/.ci/generate-licenses b/.ci/generate-licenses new file mode 100755 index 00000000000..63a6bb0409b --- /dev/null +++ b/.ci/generate-licenses @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +csource="${BASH_SOURCE[0]}" +while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done +root="$( cd -P "$( dirname "$csource" )/../" && pwd )" + +. "${root}/.ci/load-ci.sh" + +if [ "${#}" -ne 1 ]; then + printf "Usage: %s LICENSE_DIR\n" "${0}" + exit 1 +fi + +license_dir="${1}" +if [ ! -d "${license_dir}" ]; then + mkdir -p "${license_dir}" || + failure "Unable to create license directory" +fi + +pushd "${license_dir}" +license_dir="$(pwd)" || failure "Could not read license directory path" +popd + +# Move to the root +pushd "${root}" + +info "Generating Vagrant license files" + +version="$(< ./version.txt)" || + failure "Unable to read version file" + +license_date="$(date "+%Y")" || + failure "Unable to generate year for license" + +license_template="./templates/license/license.html.tmpl" +license_destination="${license_dir}/LICENSE.html" + +debug "Updating license file: ${license_destination}" + +if [ ! -f "${license_template}" ]; then + failure "Unable to locate license template (${license_template})" +fi + +sed "s/%VERSION%/${version}/" "${license_template}" > "${license_destination}" || + failure "Unable to update version in ${license_destination}" +sed -i "s/%YEAR%/${license_date}/" "${license_destination}" || + failure "Unable to update year in ${license_destination}" + +license_template="./templates/license/license.rtf.tmpl" +license_destination="${license_dir}/LICENSE.rtf" + +debug "Updating license file: ${license_destination}" + +if [ ! -f "${license_template}" ]; then + failure "Unable to locate license template (${license_template})" +fi + +sed "s/%VERSION%/${version}/" "${license_template}" > "${license_destination}" || + failure "Unable to update version in ${license_destination}" +sed -i "s/%YEAR%/${license_date}/" "${license_destination}" || + failure "Unable to update year in ${license_destination}" diff --git a/.ci/release-initiator b/.ci/release-initiator new file mode 100755 index 00000000000..e3dd23543f2 --- /dev/null +++ b/.ci/release-initiator @@ -0,0 +1,140 @@ +#!/usr/bin/env bash + +csource="${BASH_SOURCE[0]}" +while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done +root="$( cd -P "$( dirname "$csource" )/../" && pwd )" + +. "${root}/.ci/load-ci.sh" + +if [ "${#}" -ne 1 ]; then + printf "Usage: %s VERSION\n" "${0}" >&2 + exit 1 +fi + +version="${1}" + +info "Updating repository files for ${version} release" + +if [[ "${version}" = "v"* ]]; then + failure "Invalid version format, cannot start with 'v': %s" "${version}" +fi + +if ! valid_release_version "${version}"; then + failure "Invalid version format provided: %s" "${version}" +fi + +debug "Configuring git" +hashibot_git + +debug "Updating version.txt with version value: %s" "${version}" +if [ ! -f "version.txt" ]; then + failure "Unable to locate version.txt file" +fi + +printf "%s" "${version}" > version.txt + +debug "Updating CHANGELOG.md" +if [ ! -f "CHANGELOG.md" ]; then + failure "Unable to locate CHANGLOG.md file" +fi + +datestamp="$(date "+%B %d, %Y")" || + failure "Unable to generate date" + +printf "## %s (%s)\n" "${version}" "${datestamp}" > .CHANGELOG.md.new + +grep -v UNRELEASED < CHANGELOG.md >> .CHANGELOG.md.new || + failure "Unable to update CHANGELOG contents" + +mv .CHANGELOG.md.new CHANGELOG.md || + failure "Unable to overwrite CHANGELOG file" + +license_date="$(date "+%Y")" || + failure "Unable to generate year for license" + +license_template="./templates/license/license.tmpl" +license_destination="./LICENSE" + +debug "Updating license file: ${license_destination}" + +if [ ! -f "${license_template}" ]; then + failure "Unable to locate license template (${license_template})" +fi +if [ ! -f "${license_destination}" ]; then + failure "Unable to locate license destination (${license_destination})" +fi + +sed "s/%VERSION%/${version}/" "${license_template}" > "${license_destination}" || + failure "Unable to update version in ${license_destination}" +sed -i "s/%YEAR%/${license_date}/" "${license_destination}" || + failure "Unable to update year in ${license_destination}" + +debug "Updating download version in website source" + +version_file="./website/data/version.json" +if [ ! -f "${version_file}" ]; then + failure "Unable to locate version data file (%s)" "${version_file}" +fi + +sed -i "s/ \"VERSION\":.*,/ \"VERSION\": \"${version}\",/" "${version_file}" || + failure "Unable to update version data file (%s)" "${version_file}" + +debug "Commit version updates" + +# display changes before commit +git status + +git add version.txt CHANGELOG.md LICENSE "${version_file}" || + failure "Unable to stage updated release files for commit" + +git commit -m "Release ${version}" || + failure "Unable to commit updated files for release" + +release_tag="v${version}" + +debug "Creating new tag %s" "${release_tag}" + +git tag "${release_tag}" + +# Generate a new version for development +version_prefix="${version%.*}" +patch="${version##*.}" +new_patch=$(( "${patch}" + 1 )) +dev_version="${version_prefix}.${new_patch}.dev" + +debug "Updating files for new development - %s" "${dev_version}" + +debug "Updating version.txt with version value: %s" "${dev_version}" +printf "%s\n" "${dev_version}" > version.txt + +debug "Updating CHANGELOG" + +printf "## %s (UNRELEASED)\n\nFEATURES:\n\nIMPROVEMENTS:\n\nBUG FIXES:\n\nVAGRANT-GO:\n\n" "${dev_version}" > .CHANGELOG.md.new +cat CHANGELOG.md >> .CHANGELOG.md.new + +mv .CHANGELOG.md.new CHANGELOG.md || + failure "Unable to overwrite CHANGELOG file" + +debug "Updating LICENSE" + +sed "s/%VERSION%/${dev_version}/" "${license_template}" > LICENSE || + failure "Unable to update LICENSE" + +debug "Commit development version updates" + +# display changes before commit +git status + +git add version.txt CHANGELOG.md LICENSE || + failure "Unable to stage updated development files for commit" + +git commit -m "Release ${version}" || + failure "Unable to commit updated files for development" + +# Now that all changes are complete, push +debug "Pushing all changes to origin" + +git push origin main || + failure "Unable to push changes to main" +git push origin "${release_tag}" || + failure "Unable to push tag to main" diff --git a/.github/workflows/initiate-release.yml b/.github/workflows/initiate-release.yml new file mode 100644 index 00000000000..81bfdb38e20 --- /dev/null +++ b/.github/workflows/initiate-release.yml @@ -0,0 +1,24 @@ +name: Start Vagrant Release Process +on: + workflow_dispatch: + inputs: + release_version: + description: 'Release Version (example: 1.0.0)' + required: true + type: string + +jobs: + start-release: + if: github.repository == 'hashicorp/vagrant' + name: Initiate Release + runs-on: ubuntu-latest + steps: + - name: Code Checkout + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - name: Run initiator + run: ./.ci/release-initiator "${VERSION}" + env: + VERSION: ${{ inputs.release_version }} + # NOTE: custom token is used so pushed tag will trigger release workflow + HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }} + HASHIBOT_USERNAME: vagrant-bot diff --git a/templates/license/license.html.tmpl b/templates/license/license.html.tmpl new file mode 100644 index 00000000000..c69e7b32758 --- /dev/null +++ b/templates/license/license.html.tmpl @@ -0,0 +1,90 @@ + +
++ License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved. + “Business Source License” is a trademark of MariaDB Corporation Ab. +
++ Parameters +
++ For information about alternative licensing arrangements for the Licensed Work, please contact licensing@hashicorp.com. +
++ Notice +
++ Business Source License 1.1 +
++ Terms +
++ The Licensor hereby grants you the right to copy, modify, create derivative + works, redistribute, and make non-production use of the Licensed Work. The + Licensor may make an Additional Use Grant, above, permitting limited production use. +
++ Effective on the Change Date, or the fourth anniversary of the first publicly + available distribution of a specific version of the Licensed Work under this + License, whichever comes first, the Licensor hereby grants you rights under + the terms of the Change License, and the rights granted in the paragraph + above terminate. +
++ If your use of the Licensed Work does not comply with the requirements + currently in effect as described in this License, you must purchase a + commercial license from the Licensor, its affiliated entities, or authorized + resellers, or you must refrain from using the Licensed Work. +
++ All copies of the original and modified Licensed Work, and derivative works + of the Licensed Work, are subject to this License. This License applies + separately for each version of the Licensed Work and the Change Date may vary + for each version of the Licensed Work released by Licensor. +
++ You must conspicuously display this License on each original or modified copy + of the Licensed Work. If you receive the Licensed Work in original or + modified form from a third party, the terms and conditions set forth in this + License apply to your use of that work. +
++ Any use of the Licensed Work in violation of this License will automatically + terminate your rights under this License for the current and all other + versions of the Licensed Work. +
++ This License does not grant you any right in any trademark or logo of + Licensor or its affiliates (provided that you may use a trademark or logo of + Licensor as expressly required by this License). +
++ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON + AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, + EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND + TITLE. +
+ + diff --git a/templates/license/license.rtf.tmpl b/templates/license/license.rtf.tmpl new file mode 100755 index 00000000000..daac00da1aa Binary files /dev/null and b/templates/license/license.rtf.tmpl differ diff --git a/templates/license/license.tmpl b/templates/license/license.tmpl new file mode 100644 index 00000000000..2a3e703331d --- /dev/null +++ b/templates/license/license.tmpl @@ -0,0 +1,61 @@ +License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved. +“Business Source License” is a trademark of MariaDB Corporation Ab. + +Parameters + +Licensor: HashiCorp, Inc. +Licensed Work: Vagrant %VERSION%. The Licensed Work is (c) %YEAR% HashiCorp, Inc. +Additional Use Grant: You may make production use of the Licensed Work, + provided such use does not include offering the Licensed Work + to third parties on a hosted or embedded basis which is + competitive with HashiCorp's products. +Change Date: Four years from the date the Licensed Work is published. +Change License: MPL 2.0 + +For information about alternative licensing arrangements for the Licensed Work, +please contact licensing@hashicorp.com. + +Notice + +Business Source License 1.1 + +Terms + +The Licensor hereby grants you the right to copy, modify, create derivative +works, redistribute, and make non-production use of the Licensed Work. The +Licensor may make an Additional Use Grant, above, permitting limited production use. + +Effective on the Change Date, or the fourth anniversary of the first publicly +available distribution of a specific version of the Licensed Work under this +License, whichever comes first, the Licensor hereby grants you rights under +the terms of the Change License, and the rights granted in the paragraph +above terminate. + +If your use of the Licensed Work does not comply with the requirements +currently in effect as described in this License, you must purchase a +commercial license from the Licensor, its affiliated entities, or authorized +resellers, or you must refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works +of the Licensed Work, are subject to this License. This License applies +separately for each version of the Licensed Work and the Change Date may vary +for each version of the Licensed Work released by Licensor. + +You must conspicuously display this License on each original or modified copy +of the Licensed Work. If you receive the Licensed Work in original or +modified form from a third party, the terms and conditions set forth in this +License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically +terminate your rights under this License for the current and all other +versions of the Licensed Work. + +This License does not grant you any right in any trademark or logo of +Licensor or its affiliates (provided that you may use a trademark or logo of +Licensor as expressly required by this License). + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +TITLE.