Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/release_module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
env:
SUBDIR: "${{ inputs.subdir }}"
VERSION: "${{ inputs.version }}"
MODULE: "rules_pkg_${SUBDIR}"
MODULE: "rules_pkg_${{ inputs.subdir }}"

GIT_AUTHOR_NAME: "${{ github.actor }}"
GIT_AUTHOR_EMAIL: "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
Expand All @@ -48,8 +48,11 @@ jobs:
# Download `buildozer`
#
curl -o "${RUNNER_TEMP}/buildozer" -L "https://github.com/bazelbuild/buildtools/releases/download/v7.3.1/buildozer-linux-amd64"
chmod a+x "${RUNNER_TEMP}/buildozer"
"${RUNNER_TEMP}/buildozer" "set version ${VERSION}" "//${SUBDIR}/MODULE.bazel:${MODULE}" || true
git add "${MODULE}/MODULE.bazel"
git add "${SUBDIR}/MODULE.bazel"
sed -i -e "s/@AUTO_VERSION@/${VERSION}/" ${SUBDIR}/version.bzl
git add "${SUBDIR}/version.bzl"
git commit -m "Release `${MODULE}-${VERSION}`"

# 3. Push release tag.
Expand All @@ -66,4 +69,10 @@ jobs:
# This will run release_prep.sh to do the dirty work.
# TODO: https://github.com/bazelbuild/rules_pkg/issues/1031
release_files: "bazel-bin/distro/rules_pkg_${{ inputs.subdir }}-*.tgz"
tag_name: "rule_pkg_${{ inputs.subdir }}-${{ inputs.version }}"
tag_name: "rules_pkg_${{ inputs.subdir }}-${{ inputs.version }}"
# We only do a partial test. The problem is that RPM does not work on the github runners
# so we must skip, but the release_ruleset flow appends cache flags to the command. That
# makes the syntax 'bazel test //... -- -//test/rpm/... =disk_cache-flag' impossible.
# It doesn't matter. We have to do the full test anyway before hitting this, so everything
# should still work, if we only changed the version in the module.
bazel_test_command: "bazel test --build_tests_only //tests/tar/... //tests/zip/..."
11 changes: 9 additions & 2 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ set -o errexit -o nounset -o pipefail
# Passed as argument when invoking the script.
TAG="${1}"

# Get back to the root
cd ../../
# Get back to the root, because sometimes we are in .github/workflows, but other times we are not.
# That seems plainly dumb, but working around it is far less effort than writing new workflows
# where this is not a problem.
if [[ ! -f MODULE.bazel ]] ; then
cd ..
fi
if [[ ! -f MODULE.bazel ]] ; then
cd ..
fi

case "${TAG}" in
[0-9]* )
Expand Down
3 changes: 2 additions & 1 deletion distro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ print_rel_notes(
outs = ["rules_pkg_providers_relnotes.txt"],
artifact_name = "rules_pkg_providers-%s.tgz" % providers_version,
org = "bazelbuild",
repo = "rules_pkg_providers",
release_name = "rules_pkg_providers-%s" % providers_version,
repo = "rules_pkg",
version = providers_version,
)
14 changes: 9 additions & 5 deletions pkg/releasing/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ def print_rel_notes(
name,
repo,
version,
artifact_name = None,
outs = None,
setup_file = "",
artifact_name = None,
changelog = None,
deps_method = "",
toolchains_method = "",
mirror_host = None,
org = "bazelbuild",
changelog = None,
mirror_host = None):
release_name = None,
setup_file = "",
toolchains_method = ""):
if not artifact_name:
artifact_name = ":%s-%s.tar.gz" % (repo, version)
if not release_name:
release_name = ":%s-%s" % (repo, version)

# Must use Label to get a path relative to the rules_pkg repository,
# instead of the calling BUILD file.
Expand All @@ -26,6 +29,7 @@ def print_rel_notes(
"--repo=%s" % repo,
"--version=%s" % version,
"--tarball=$(location %s)" % artifact_name,
"--release_name='%s'" % release_name,
]
if setup_file:
cmd.append("--setup_file=%s" % setup_file)
Expand Down
13 changes: 8 additions & 5 deletions pkg/releasing/print_rel_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@


def print_notes(org, repo, version, tarball_path, mirror_host=None,
deps_method=None, setup_file=None, toolchains_method=None,
changelog=''):
deps_method=None, release_name=None, setup_file=None,
toolchains_method=None, changelog=''):
file_name = os.path.basename(tarball_path)
sha256 = release_tools.get_package_sha256(tarball_path)

url = 'https://github.com/%s/%s/releases/download/%s/%s' % (
org, repo, version, file_name)
org, repo, release_name, file_name)
mirror_url = 'https://%s/github.com/%s/%s/releases/download/%s/%s' % (
mirror_host, org, repo, version, file_name) if mirror_host else None
workspace_stanza = release_tools.workspace_content(
Expand Down Expand Up @@ -70,10 +70,10 @@ def print_notes(org, repo, version, tarball_path, mirror_host=None,
}))
if mirror_url:
file = os.path.basename(tarball_path)
path = 'github.com/{org}/{repo}/releases/download/{version}/{file}'.format(
path = 'github.com/{org}/{repo}/releases/download/{release_name}/{file}'.format(
org=org,
repo=repo,
version=version,
release_name=release_name,
file=file
)

Expand Down Expand Up @@ -109,6 +109,8 @@ def main():
'--repo', default=None, required=True, help='Repo name')
parser.add_argument(
'--version', default=None, required=True, help='Release version')
parser.add_argument(
'--release_name', default=None, required=True, help='The release name: usually submodule-version')
parser.add_argument(
'--tarball_path', default=None,
required=True, help='path to release tarball')
Expand Down Expand Up @@ -139,6 +141,7 @@ def main():
deps_method=options.deps_method,
changelog=changelog,
mirror_host=options.mirror_host,
release_name=options.release_name,
setup_file=options.setup_file,
toolchains_method=options.toolchains_method)

Expand Down
2 changes: 1 addition & 1 deletion providers/version.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The version of rules_pkg_providers."""

version = "1.0.0"
version = "@AUTO_VERSION@"