Skip to content

Commit dda27a3

Browse files
Validate packages.yml uses proper version on release, fix bump-version to handle git hash conversion
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent 9b6dae4 commit dda27a3

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/bump-version.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ jobs:
6161
- name: Bump version
6262
run: |
6363
sed -i 's/^version = "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"/version = "${{ inputs.cli-version }}"/' ./pyproject.toml
64+
- name: Convert git hash reference to package version format (if needed)
65+
run: |
66+
PACKAGES_FILE="./elementary/monitor/dbt_project/packages.yml"
67+
if grep -q 'git: https://github.com/elementary-data/dbt-data-reliability.git' "$PACKAGES_FILE"; then
68+
echo "Found git hash reference in packages.yml, converting to package version format..."
69+
# Replace the git+revision block with a package+version block using a placeholder version
70+
sed -i '/- git: https:\/\/github.com\/elementary-data\/dbt-data-reliability.git/{N;s/- git: https:\/\/github.com\/elementary-data\/dbt-data-reliability.git\n revision: [a-f0-9]*/- package: elementary-data\/elementary\n version: 0.0.0/}' "$PACKAGES_FILE"
71+
echo "Converted to package format with placeholder version."
72+
else
73+
echo "packages.yml already uses package version format."
74+
fi
6475
- name: Bump version for package (using input)
6576
if: ${{ needs.validate-version.outputs.validated-dbt-package-version != ''}}
6677
run: |

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,27 @@ env:
99
IMAGE_NAME: ${{ github.repository }}
1010

1111
jobs:
12+
validate-packages-yml:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Elementary
16+
uses: actions/checkout@v4
17+
18+
- name: Validate dbt-data-reliability is not a git hash reference
19+
run: |
20+
PACKAGES_FILE="./elementary/monitor/dbt_project/packages.yml"
21+
if grep -q 'git: https://github.com/elementary-data/dbt-data-reliability.git' "$PACKAGES_FILE"; then
22+
echo "::error::packages.yml contains a git hash reference for dbt-data-reliability. Releases must use a proper package version (e.g. 'package: elementary-data/elementary' with a 'version:' field). Please update packages.yml before releasing."
23+
exit 1
24+
fi
25+
if ! grep -q 'package: elementary-data/elementary' "$PACKAGES_FILE"; then
26+
echo "::error::packages.yml does not contain a proper package reference for elementary-data/elementary. Please update packages.yml before releasing."
27+
exit 1
28+
fi
29+
echo "packages.yml validation passed - using proper package version reference."
30+
1231
publish-to-pypi:
32+
needs: validate-packages-yml
1333
runs-on: ubuntu-latest
1434
steps:
1535
- name: Checkout Elementary
@@ -39,6 +59,7 @@ jobs:
3959
password: ${{ secrets.PYPI_PASS }}
4060

4161
build-and-push-docker-image:
62+
needs: validate-packages-yml
4263
runs-on: ubuntu-latest
4364
permissions:
4465
contents: read
@@ -77,6 +98,7 @@ jobs:
7798
labels: ${{ steps.meta.outputs.labels }}
7899

79100
merge-to-docs:
101+
needs: validate-packages-yml
80102
runs-on: ubuntu-latest
81103
steps:
82104
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)