diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73a203c..054a25c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,6 @@ jobs: matrix: # If `Windows` support is removed - state so inthe README.md os: [ubuntu-latest, macos-latest, windows-latest] - bazel_mode: [bzlmod, workspace, both] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -31,11 +30,8 @@ jobs: # Share repository cache between workflows. repository-cache: true - name: Built & Test - env: - BZLMOD: ${{ matrix.bazel_mode != 'workspace' && '--enable_bzlmod' || '--noenable_bzlmod' }} - WORKSPACE: ${{ matrix.bazel_mode != 'bzlmod' && '--enable_workspace' || '--noenable_workspace' }} run: | - bazel test ${{env.BZLMOD}} ${{env.WORKSPACE}} //... + bazel test //... # Single aggregating gate for branch protection. It depends on every job that # must pass, so "done" is the only status check that needs to be marked diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index ff60290..1f3577c 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -28,7 +28,6 @@ function die() { # Custom args to update as needed. PACKAGE_NAME="bzl" BAZELMOD_NAME="helly25_bzl" -WORKSPACE_NAME="helly25_bzl" PATCHES=() # Automatic vars from workflow integration. @@ -40,8 +39,8 @@ if [[ "${TAG}" == "v${VERSION}" ]]; then fi # Computed vars. -PREFIX="${PACKAGE_NAME}-${TAG}" # Internal archive root directory folder: bzl-0.4.0 -ARCHIVE="${PACKAGE_NAME}-${TAG}.tar.gz" # Target asset name on GitHub: bzl-0.4.0.tar.gz +PREFIX="${PACKAGE_NAME}-${TAG}" # Internal archive root directory folder: bzl-0.5.0 +ARCHIVE="${PACKAGE_NAME}-${TAG}.tar.gz" # Target asset name on GitHub: bzl-0.5.0.tar.gz BAZELMOD_VERSION="$(sed -rne 's,.*version = "([0-9]+([.][0-9]+)+.*)".*,\1,p' BUILD.bazel # Apply patches -for patch in "${PATCHES[@]}"; do +for patch in ${PATCHES[@]+"${PATCHES[@]}"}; do patch -s -p 1 <"${patch}" done @@ -85,10 +84,18 @@ EXCLUDES=( done } >>.gitattributes -# Build the archive directly out into the parent repo workspace root folder path -git archive --format=tar.gz --prefix="${PREFIX}/" "${TAG}" -o "${ARCHIVE}" --add-virtual-file="${PREFIX}/VERSION:${VERSION}" --worktree-attributes - -SHA256="$(shasum -a 256 "${ARCHIVE}" | awk '{print $1}')" +# Build the archive from the patched/generated worktree, not the committed +# "${TAG}" tree: `git archive "${TAG}"` reads the commit and would silently drop +# the edits above (any patches, the generated BUILD.bazel). Stage the worktree +# into a THROWAWAY index so the real index/checkout is never touched (nothing to +# undo afterwards), and archive that tree. export-ignore still applies via the +# staged .gitattributes (+ --worktree-attributes). +TMP_INDEX="$(mktemp -u)" +GIT_INDEX_FILE="${TMP_INDEX}" git read-tree HEAD +GIT_INDEX_FILE="${TMP_INDEX}" git add --all +ARCHIVE_TREE="$(GIT_INDEX_FILE="${TMP_INDEX}" git write-tree)" +rm -f "${TMP_INDEX}" +git archive --format=tar.gz --prefix="${PREFIX}/" -o "${ARCHIVE}" --add-virtual-file="${PREFIX}/VERSION:${VERSION}" --worktree-attributes "${ARCHIVE_TREE}" # Print header echo "# Version ${VERSION}" @@ -103,17 +110,4 @@ cat <