diff --git a/.github/workflows/update-version-file.yml b/.github/workflows/update-version-file.yml deleted file mode 100644 index a8b984f..0000000 --- a/.github/workflows/update-version-file.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Sync ada-version file - -on: - push: - tags: - - 'v*' # run automatically when a tag is pushed - workflow_dispatch: # allow manual trigger in Github UI - -jobs: - update-version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # we need full tag history - - - name: Determine version - run: | - if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then - # Get the latest tag from Git - VERSION=$(git describe --tags --abbrev=0) - else - # Use the tag that triggered the workflow - VERSION="${GITHUB_REF_NAME}" - fi - echo "Detected version: ${VERSION}" - echo "VERSION=${VERSION}" >> $GITHUB_ENV - - - name: Write ada-version file - run: | - mkdir -p ada/etc - echo "${VERSION}" > ada/etc/ada-version - - - name: Commit and push ada-version - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git add ada/etc/ada-version - git commit -m "Update ada-version to ${VERSION}" || echo "No changes" - git push diff --git a/.github/workflows/Update-ada-version.yml b/.github/workflows/update_ada_version.yml similarity index 70% rename from .github/workflows/Update-ada-version.yml rename to .github/workflows/update_ada_version.yml index f56d217..1fb048a 100644 --- a/.github/workflows/Update-ada-version.yml +++ b/.github/workflows/update_ada_version.yml @@ -18,19 +18,13 @@ jobs: - name: Determine version or branch run: | - if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then - VERSION="${GITHUB_REF_NAME}" - elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then - VERSION=$(git rev-parse --abbrev-ref HEAD) - else - VERSION="${GITHUB_REF_NAME}" - fi + VERSION="${GITHUB_REF_NAME}" echo "Using version identifier: ${VERSION}" echo "VERSION=${VERSION}" >> $GITHUB_ENV - name: Update version in ada script run: | - sed -i "s/ADA_VERSION=.*/ADA_VERSION=\"${VERSION}\"/" ada/ada + sed -i".tmp" "s/ADA_VERSION=.*/ADA_VERSION=\"${VERSION}\"/" ada/ada - name: Commit and push updated ada script run: | diff --git a/ada/ada b/ada/ada index 4b7c13a..a44015b 100755 --- a/ada/ada +++ b/ada/ada @@ -298,6 +298,10 @@ get_permissions () { # Set default values and initialize variables # set_defaults() { + # The ADA_VERSION value will be automatically updated by Github action Update-ada-version.yml + # For a release, it will contain the version number (like v3.1). + # For a branch, it will contain the branch name. + ADA_VERSION="123-provide-reliable-ada---version" args= api= debug=false @@ -399,9 +403,7 @@ get_args() { usage ;; --version ) - git_dir=$(dirname "${script_dir}") - _VERSION_PLACEHOLDER=$(git --git-dir="${git_dir}/.git" describe --tags --abbrev=0 2>/dev/null || echo "v3.0+") - echo "${_VERSION_PLACEHOLDER}" + echo "$ADA_VERSION" exit 1 ;; --tokenfile ) diff --git a/ada/etc/ada-version b/ada/etc/ada-version deleted file mode 100644 index 8616689..0000000 --- a/ada/etc/ada-version +++ /dev/null @@ -1 +0,0 @@ -v3.1