diff --git a/.bcr/config.yml b/.bcr/config.yml new file mode 100644 index 0000000..4225f4f --- /dev/null +++ b/.bcr/config.yml @@ -0,0 +1,3 @@ +fixedReleaser: + login: fmeum + email: fabian@meumertzhe.im diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json new file mode 100644 index 0000000..34fa175 --- /dev/null +++ b/.bcr/metadata.template.json @@ -0,0 +1,15 @@ +{ + "homepage": "https://github.com/fmeum/buildozer", + "maintainers": [ + { + "email": "fabian@meumertzhe.im", + "github": "fmeum", + "name": "Fabian Meumertzheim" + } + ], + "repository": [ + "github:fmeum/buildozer" + ], + "versions": [], + "yanked_versions": {} +} diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml new file mode 100644 index 0000000..bc6b157 --- /dev/null +++ b/.bcr/presubmit.yml @@ -0,0 +1,19 @@ +bcr_test_module: + module_path: tests + matrix: + platform: + - debian10 + - ubuntu2004 + - macos + - macos_arm64 + - windows + tasks: + run_test_module: + name: Run test module + platform: ${{ platform }} + shell_commands: + - bazel run //:run_buildozer + build_targets: + - //... + test_targets: + - //... diff --git a/.bcr/source.template.json b/.bcr/source.template.json new file mode 100644 index 0000000..2037471 --- /dev/null +++ b/.bcr/source.template.json @@ -0,0 +1,5 @@ +{ + "integrity": "", + "strip_prefix": "{REPO}-{VERSION}", + "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz" +} diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc new file mode 100644 index 0000000..8500d61 --- /dev/null +++ b/.github/workflows/ci.bazelrc @@ -0,0 +1 @@ +# Required by the release workflow diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2d231d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,18 @@ +# Based on +# https://github.com/bazel-contrib/rules-template/blob/07fefdbc09d7ca2a49d24220e00dac2efc2bf9b7/.github/workflows/release.yml + +# Cut a release whenever a new tag is pushed to the repo. +# You should use an annotated tag, like `git tag -a v1.2.3` +# and put the release notes into the commit message for the tag. +name: Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v5 + with: + release_files: buildozer-*.tar.gz diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh new file mode 100755 index 0000000..47d77fe --- /dev/null +++ b/.github/workflows/release_prep.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Based on +# https://github.com/bazel-contrib/rules-template/blob/07fefdbc09d7ca2a49d24220e00dac2efc2bf9b7/.github/workflows/release_prep.sh + +set -o errexit -o nounset -o pipefail + +# Set by GH actions, see +# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables +TAG=${GITHUB_REF_NAME} +# The prefix is chosen to match what GitHub generates for source archives +PREFIX="buildozer-${TAG:1}" +ARCHIVE="buildozer-$TAG.tar.gz" +git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE +SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') + +cat << EOF +## Using Bzlmod + +1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\` (default with Bazel 7). +2. Add to your \`MODULE.bazel\` file: + +\`\`\`starlark +bazel_dep(name = "buildozer", version = "${TAG:1}") +\`\`\` +EOF diff --git a/release/BUILD.bazel b/release/BUILD.bazel index 798d791..2c47128 100644 --- a/release/BUILD.bazel +++ b/release/BUILD.bazel @@ -2,8 +2,3 @@ sh_binary( name = "update", srcs = ["update.sh"], ) - -sh_binary( - name = "release", - srcs = ["release.sh"], -) diff --git a/release/release.sh b/release/release.sh deleted file mode 100755 index ccbedf9..0000000 --- a/release/release.sh +++ /dev/null @@ -1,34 +0,0 @@ -#/usr/bin/env bash - -set -euo pipefail - -if [[ "$#" -ne 1 ]]; then - echo "Usage: bazel run //release " - exit 1 -fi -version="$1" - -cd $BUILD_WORKSPACE_DIRECTORY - -release_archive=buildozer-v${version}.tar.gz -git archive --format=tar.gz -o $release_archive main -trap 'rm -f -- "$release_archive"' EXIT - -notes=$(cat <