Skip to content

Commit

Permalink
Drop support for .bufversion file
Browse files Browse the repository at this point in the history
Removes support for `.bufversion` file in the version resolution.
  • Loading branch information
emcfarlane committed Jun 3, 2024
1 parent 6b85a86 commit f1d889b
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 36 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 1 addition & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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}`);
Expand All @@ -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.
Expand Down
1 change: 0 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
17 changes: 0 additions & 17 deletions examples/version-file.yaml

This file was deleted.

9 changes: 1 addition & 8 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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}`);
Expand All @@ -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 "";
}
Expand Down

0 comments on commit f1d889b

Please sign in to comment.