From f1d889bfa3132277e8a09b5f537b1c4b79af795b Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Mon, 3 Jun 2024 16:33:52 -0400 Subject: [PATCH] Drop support for .bufversion file Removes support for `.bufversion` file in the version resolution. --- README.md | 1 - dist/index.js | 10 +--------- examples/README.md | 1 - examples/version-file.yaml | 17 ----------------- src/installer.ts | 9 +-------- 5 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 examples/version-file.yaml diff --git a/README.md b/README.md index ebfdd00..960e634 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,6 @@ To ensure the version of `buf` is consistent across workflows it's recommended t If no version is specified in the workflow config, the action will resolve the version in order of precendence: - A version specified in the environment variable `${BUF_VERSION}`. -- A version specified in a file named `.bufversion` in the current working directory. - The version of `buf` that is already installed on the runner (if it exists) - The latest version of the `buf` binary from the official releases on GitHub. diff --git a/dist/index.js b/dist/index.js index 9dca6bf..68965f5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -37571,8 +37571,6 @@ function getEnv(name) { return (process.env[name.toLowerCase()] ?? process.env[name.toUpperCase()] ?? ""); } -// EXTERNAL MODULE: external "fs" -var external_fs_ = __nccwpck_require__(7147); // EXTERNAL MODULE: ./node_modules/@actions/tool-cache/lib/tool-cache.js var tool_cache = __nccwpck_require__(7784); // EXTERNAL MODULE: ./node_modules/semver/index.js @@ -37596,7 +37594,6 @@ var semver = __nccwpck_require__(1383); - const requiredVersion = ">=1.32.0"; // installBuf installs the buf binary and returns the path to the binary. async function installBuf(github, versionInput) { @@ -37644,7 +37641,7 @@ async function installBuf(github, versionInput) { core.info(`Setup buf (${resolvedVersion}) at ${cachePath}`); return binName; } -// resolveVersion from the input, environment, or .bufversion file. +// resolveVersion from the input or environment. function resolveVersion(versionSpec) { if (versionSpec) { core.info(`Using the version of buf from the input: ${versionSpec}`); @@ -37655,11 +37652,6 @@ function resolveVersion(versionSpec) { core.info(`Using the version of buf from $BUF_VERSION: ${resolvedVersion}`); return resolvedVersion; } - else if (external_fs_.existsSync(".bufversion")) { - const resolvedVersion = external_fs_.readFileSync(".bufversion", "utf8").trim(); - core.info(`Using the version of buf from the .bufversion file: ${resolvedVersion}`); - return resolvedVersion; - } return ""; } // latestVersion returns the latest version of buf from GitHub releases. diff --git a/examples/README.md b/examples/README.md index e0193c9..a29b85c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -19,6 +19,5 @@ This directory contains examples of how to use the `buf` GitHub Action. - [validate-push.yaml](./validate-push.yaml): Validate checks before pushing to the repository. - [version-env.yaml](./version-env.yaml): Resolve the `buf` version from an environment variable (`BUF_VERSION`). -- [version-file.yaml](./version-file.yaml): Resolve the `buf` version from a file (`.bufversion`). - [version-input.yaml](./version-input.yaml): Resolve the `buf` version from an action input (`version`). - [version-latest.yaml](./version-latest.yaml): Use the latest `buf` version. diff --git a/examples/version-file.yaml b/examples/version-file.yaml deleted file mode 100644 index 170f5de..0000000 --- a/examples/version-file.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# This workflow downloads the version of buf specified in the .bufversion file. -name: ci -on: - push: -permissions: - contents: read -jobs: - buf: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: | - echo "1.32.0" > .bufversion - - uses: bufbuild/buf-action@v0.1.1 - with: - setup_only: true - - run: buf version diff --git a/src/installer.ts b/src/installer.ts index 83614f9..163d544 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -import * as fs from "fs"; import * as core from "@actions/core"; import * as exec from "@actions/exec"; import * as tc from "@actions/tool-cache"; @@ -87,7 +86,7 @@ export async function installBuf( return binName; } -// resolveVersion from the input, environment, or .bufversion file. +// resolveVersion from the input or environment. function resolveVersion(versionSpec: string): string { if (versionSpec) { core.info(`Using the version of buf from the input: ${versionSpec}`); @@ -96,12 +95,6 @@ function resolveVersion(versionSpec: string): string { const resolvedVersion = getEnv("BUF_VERSION"); core.info(`Using the version of buf from $BUF_VERSION: ${resolvedVersion}`); return resolvedVersion; - } else if (fs.existsSync(".bufversion")) { - const resolvedVersion = fs.readFileSync(".bufversion", "utf8").trim(); - core.info( - `Using the version of buf from the .bufversion file: ${resolvedVersion}`, - ); - return resolvedVersion; } return ""; }