Skip to content

Commit

Permalink
Configure bcr
Browse files Browse the repository at this point in the history
  • Loading branch information
ewianda committed Mar 24, 2024
1 parent fcf9e31 commit 2f3fca8
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .bcr/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixedReleaser:
login: ewianda
email: [email protected]
18 changes: 18 additions & 0 deletions .bcr/metadata.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"homepage": "https://github.com/benchsci/rules_nodejs_gazelle",
"maintainers": [
{
"name": "Elvis Wianda",
"email": "[email protected]",
"github": "ewianda"
},
{
"name": "Collin Heathman",
"email": "[email protected]",
"github": "ColinHeathman"
}
],
"repository": ["https://github.com/benchsci/rules_nodejs_gazelle"],
"versions": [],
"yanked_versions": {}
}
12 changes: 12 additions & 0 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
bcr_test_module:
module_path: 'examples/nextjs'
matrix:
bazel: ['7.x', '6.x']
platform: ['debian10', 'macos', 'ubuntu2004', 'windows']
tasks:
run_tests:
name: 'Run test module'
bazel: ${{ bazel }}
platform: ${{ platform }}
test_targets:
- '//apps/alpha/...'
5 changes: 5 additions & 0 deletions .bcr/source.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"integrity": "**leave this alone**",
"strip_prefix": "{REPO}-{VERSION}",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_nodejs_gazelle-{TAG}.tar.gz"
}
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ jobs:
# Bazel will download bazel to here
XDG_CACHE_HOME: ~/.cache/bazel-repo
run: bazel test //...
- name: Prepare workspace snippet
- name: Prepare Release
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
- name: Release
uses: benchsci/action-gh-release@v1
with:
# Use GH feature to populate the changelog automatically
generate_release_notes: true
body_path: release_notes.txt
files: rules_nodejs_gazelle-*.tar.gz
fail_on_unmatched_files: true

20 changes: 8 additions & 12 deletions .github/workflows/workspace_snippet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@ 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
NAME=rules_nodejs_gazelle
COMMIT=$(git rev-parse HEAD)
PREFIX=${NAME}-${COMMIT}
SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${COMMIT} | gzip | shasum -a 256 | awk '{print $1}')
INTEGRITY=$(git archive --format=tar --prefix=${PREFIX}/ ${COMMIT} | gzip | openssl dgst -sha256 -binary | openssl base64 -A)
TAG=${GITHUB_REF_NAME}
# The prefix is chosen to match what GitHub generates for source archives
PREFIX="${NAME}-${TAG:1}"
ARCHIVE="${NAME}-$TAG.tar.gz"
git archive --format=tar --prefix="${PREFIX}/" "${TAG}" | gzip >"$ARCHIVE"
SHA=$(shasum -a 256 "$ARCHIVE" | awk '{print $1}')

cat <<EOF
MODULE.bazel setup:
\`\`\`starlark
bazel_dep(name = "com_github_benchsci_rules_nodejs_gazelle", version = "0.0.0", repo_name = "com_github_benchsci_rules_nodejs_gazelle")
bazel_dep(name = "com_github_benchsci_rules_nodejs_gazelle", version = "${TAG:1}", repo_name = "com_github_benchsci_rules_nodejs_gazelle")
archive_override(
module_name = "com_github_benchsci_rules_nodejs_gazelle",
integrity = "sha256-${INTEGRITY}",
strip_prefix = "${PREFIX}",
urls = ["https://github.com/benchsci/rules_nodejs_gazelle/archive/$COMMIT.tar.gz"],
)
\`\`\`
WORKSPACE setup:
Expand All @@ -32,7 +28,7 @@ http_archive(
name = "com_github_benchsci_rules_nodejs_gazelle",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/benchsci/rules_nodejs_gazelle/archive/$COMMIT.tar.gz",
url = "https://github.com/benchsci/rules_nodejs_gazelle/releases/download/${TAG}/${ARCHIVE}",
)
\`\`\`
EOF

0 comments on commit 2f3fca8

Please sign in to comment.