Skip to content

Commit

Permalink
Fix OPENMETHANE_PRIOR_VERSION receiving inconsistent values in actions
Browse files Browse the repository at this point in the history
When building from a version tag (v0.0.0) this should always contain the version, however the metadata-action step sometimes populates this with build-XYZ. This change will always explicitly source the version from pyproject.toml which should always contain a valid semver string.
  • Loading branch information
aethr committed Jan 9, 2025
1 parent b03220e commit 0dafb6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from pyproject.toml
id: version
run: |
PACKAGE_VERSION=$(grep -oP '^version = "\K(.+)(?=")' pyproject.toml)
echo "version=v$PACKAGE_VERSION" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
Expand All @@ -71,7 +76,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
OPENMETHANE_PRIOR_VERSION=${{ steps.meta.outputs.version }}
OPENMETHANE_PRIOR_VERSION=${{ steps.version.outputs.version }}
push: true
pull: false
cache-from: type=gha
Expand Down

0 comments on commit 0dafb6e

Please sign in to comment.