Skip to content

stfc/check-version-action

Repository files navigation

Check Version

GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Actions Workflow Status codecov

This action compares the application version number from your working branch to the main branch.

You can also check that the first image version that appears in your docker-compose.yaml file will match the application version

The comparison follows the PEP 440 Version Identification and Dependency Specification.

More detailed information about the versions can be found here

Usage

Notes:

As of October 2024 GitHub actions using Docker Containers can only be run on GitHub runners using a Linux operating system.
Read here for details: Link to GitHub docs

The release tag is extracted and stored in $GITHUB_ENV, you can access this in your workflow with $ {{ env.release_tag }}

- name: Checkout main
  uses: actions/checkout@v4
  with:
    # Change to "master" if needed
    ref: 'main'
    # Do not change the path here
    path: 'main'

- name: Checkout current working branch
  uses: actions/checkout@v4
  with:
    # Do not change the path here
    path: 'branch'
    
- name: Compare versions
  # Don't run on main otherwise it will compare main with main
  if: ${{ github.ref != 'refs/heads/main' }} 
  id: version_comparison
  uses: khalford/check-version-action@main
  with:
    # Path to version file from project root
    app_version_path: "version.txt"
    # Optional: To check if compose image version matches application version
    docker_compose_path: "docker-compose.yaml"
    
- name: Log App Success
  if: ${{ env.app_updated == 'true' }}
  run: |
    echo "App version has been updated correctly!"

# Optional: If using the docker compose check
- name: Log Compose Success
  if: ${{ env.compose_updated == 'true' }}
  run: |
    echo "Compose version has been updated correctly!"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published