Skip to content

Provide reliable ada --version way #123

@onnozweers

Description

@onnozweers

ada --version now relies on git to provide the version number. However, we know a few sysadmins who install Ada not with git but with other tools (like Ansible scripts). Now they have to do some hacking to make ada --version work properly.

Github has automation tools that could help here. ChatGPT suggested something like this Github action workflow:

name: Sync ada-version file

on:
  push:
    tags:
      - 'v*'   # run only when a version tag is pushed (like v1.2.3)

jobs:
  update-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Extract tag
        run: echo "VERSION=${GITHUB_REF_NAME}" >> $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

When this works, a file /ada/etc/ada-version would be created, containing the version number. An admin could then adapt their Ansible task to download the ada-version file together with ada, and distribute them together. The admin would then be released of the burden of maintaining the version number themselves. ada --version would just work, without depending on git.

This PR code could then be used, perhaps with a slight modification (such as the location of the ada-version file). #121

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions