diff --git a/.husky/pre-commit b/.husky/pre-commit index d6cb288..7cf7e23 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,8 @@ -npm run build +if ! git diff --quiet --exit-code -- dist/apps/version-autopilot; then + npm run build + + if git diff --quiet --exit-code -- dist/apps/version-autopilot; then + echo "Error: Recommit as there are changes in the dist/apps/version-autopilot folder." + exit 1 + fi +fi diff --git a/README.md b/README.md index 5122919..ed25789 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ ## Version Autopilot -This is perfect for packages that are not meant to be consumed by other packages, like a website or a mobile app, -where semantic versioning is not required. +This is perfect for packages that are not meant to be **consumed** by other packages, like a website or a mobile app, +where semantic versioning is not required and is continuously deployed. -This will automatically increment the version on every "run" of your github action pipeline. +This will automatically increment the version on every **run** of your github action pipeline. ```yaml @@ -25,8 +25,14 @@ steps: - name: example in README.md output run: | echo "github.run_number: ${{ github.run_number }}" + + # useful for container image and package names echo "version_autopilot_string_recommended: ${{ steps.version-autopilot.outputs.version_autopilot_string_recommended }}" + + # base to derive your own versioning naming scheme echo "version_autopilot_string: ${{ steps.version-autopilot.outputs.version_autopilot_string }}" + + # android and ios version codes echo "version_autopilot_code: ${{ steps.version-autopilot.outputs.version_autopilot_code }}" ``` @@ -35,11 +41,13 @@ steps: If you have an existing application you can modify the `major`.`minor` and `shift` inputs to match the current version of your application. See our [.github/workflows/tests.version-autopilot.yml](.github/workflows/tests.version-autopilot.yml) for how rollover works. We leverage `${{github.run_number}}` internally to increment the version. -If you are looking for semantic versioning use a [release pipeline](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). +If you are looking for semantic versioning research [release pipeline](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) and git tags. ## Need help with your continuous delivery or k8s clusters? -We can help you with that. Contact us at [improvingstartups.com](https://improvingstartups.com) for more information. +Large language models (LLMs) cannot solve your organization's people problems. +If your software teams need help and are falling behind, consider an actual human +who can spot and help steer the ship away from danger. -Example of where we use this publicly: [k8s packages](https://console.cloud.google.com/artifacts/docker/wwwrobusthavencom/us-central1/public-dev?project=wwwrobusthavencom) +Contact us at [improvingstartups.com](https://improvingstartups.com). \ No newline at end of file diff --git a/apps/version-autopilot/src/main.ts b/apps/version-autopilot/src/main.ts index e7c1d72..43ede85 100644 --- a/apps/version-autopilot/src/main.ts +++ b/apps/version-autopilot/src/main.ts @@ -23,7 +23,7 @@ async function run() { const patch = process.env['PATCH_OVERRIDE']? parseInt(process.env['PATCH_OVERRIDE'] || '0', 10) : github.context.runNumber; const version = getVersion(major, minor, patch, shift); const shortSha = `${github.context.sha}`.substring(0, 12); - let versionStringRecommended = `${version.versionString}-${process.env['GITHUB_HEAD_REF'] || ''}-${shortSha}`; + let versionStringRecommended = `${version.versionString}-${process.env['GITHUB_REF_NAME'] || ''}-${shortSha}`; if (github.context.eventName === 'pull_request') { versionStringRecommended = `${version.versionString}-pr-${github.context.payload.pull_request.number}-${shortSha}`; } diff --git a/dist/apps/version-autopilot/main.js b/dist/apps/version-autopilot/main.js index 69b4b9c..deeeeaf 100644 --- a/dist/apps/version-autopilot/main.js +++ b/dist/apps/version-autopilot/main.js @@ -23123,7 +23123,7 @@ async function run() { const patch = process.env["PATCH_OVERRIDE"] ? parseInt(process.env["PATCH_OVERRIDE"] || "0", 10) : github.context.runNumber; const version2 = getVersion(major, minor, patch, shift); const shortSha = `${github.context.sha}`.substring(0, 12); - let versionStringRecommended = `${version2.versionString}-${process.env["GITHUB_HEAD_REF"] || ""}-${shortSha}`; + let versionStringRecommended = `${version2.versionString}-${process.env["GITHUB_REF_NAME"] || ""}-${shortSha}`; if (github.context.eventName === "pull_request") { versionStringRecommended = `${version2.versionString}-pr-${github.context.payload.pull_request.number}-${shortSha}`; }