Skip to content

Commit

Permalink
fix version things for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Dec 7, 2024
1 parent 8782e47 commit 1d36766
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/_package-directory.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: "Package directory"

on:
pull_request:
workflow_call:
inputs:
package:
Expand All @@ -12,6 +11,9 @@ on:
directory:
description: "The root directory of the package"
value: ${{ jobs.package.outputs.directory }}
version-file:
description: "The path to the version file of the package"
value: ${{ jobs.package.outputs.version-file }}

defaults:
run:
Expand All @@ -22,13 +24,17 @@ jobs:
runs-on: ${{ vars.DEFAULT_RUNNER }}
outputs:
directory: ${{ steps.package.outputs.directory }}
version-file: ${{ steps.package.outputs.version-file }}
steps:
- id: package
run: |
if [[ ${{ inputs.package }} == "dbt-adapters" ]]
then
directory=""
version_file="./dbt/adapters/__about__.py"
else
directory="${{ inputs.package }}/"
version_file="./src/dbt/adapters/$(cut -c 5- ${{ inputs.package }})/__version__.py"
fi
echo "directory=$directory" >> $GITHUB_OUTPUT
echo "version-file=version_file" >> $GITHUB_OUTPUT
3 changes: 1 addition & 2 deletions .github/workflows/_publish-internal.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: "Publish internally"

on:
pull_request:
workflow_call:
inputs:
package:
Expand Down Expand Up @@ -82,7 +81,7 @@ jobs:
versions_published: ${{ steps.published.outputs.versions }}
- run: |
VERSION=${{ steps.next.outputs.internal_release_version }}+$(git rev-parse HEAD)
tee <<< "version = \"$VERSION\"" ./src/dbt/adapters/athena/__version__.py
tee <<< "version = \"$VERSION\"" ${{ needs.package.outputs.version-file }}
working-directory: ./${{ needs.package.outputs.directory }}
- run: sed -i "/dbt-core[<>~=]/d" ./pyproject.toml
working-directory: ./${{ needs.package.outputs.directory }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/_publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: "Publish to PyPI"

on:
pull_request:
workflow_call:
inputs:
package:
Expand Down Expand Up @@ -69,7 +68,7 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: ${{ vars.PYPI_REPOSITORY_URL }}
packages-dir: ${{ inputs.package }}/dist/
packages-dir: ./${{ needs.package.outputs.directory }}dist/

verify:
runs-on: ${{ vars.DEFAULT_RUNNER }}
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ code-quality = "pre-commit run --all-files"
unit-tests = "python -m pytest {args:tests/unit}"
workflow-code-quality = "gh workflow run _code-quality.yml --ref $(git rev-parse --abbrev-ref HEAD) -f branch=$(git rev-parse --abbrev-ref HEAD)"
workflow-generate-changelog = "gh workflow run _generate-changelog.yml --ref $(git rev-parse --abbrev-ref HEAD) -f package=dbt-adapters -f merge=false -f branch=$(git rev-parse --abbrev-ref HEAD)"
workflow-publish-internal = "gh workflow run _publish-internal.yml --ref $(git rev-parse --abbrev-ref HEAD) -f package=dbt-adapters -f deploy-to=test -f branch=$(git rev-parse --abbrev-ref HEAD)"
workflow-publish-pypi = "gh workflow run _publish-pypi.yml --ref $(git rev-parse --abbrev-ref HEAD) -f package=dbt-adapters -f deploy-to=test -f branch=$(git rev-parse --abbrev-ref HEAD)"
workflow-unit-tests = "gh workflow run _unit-tests.yml --ref $(git rev-parse --abbrev-ref HEAD) -f package=dbt-adapters -f branch=$(git rev-parse --abbrev-ref HEAD)"
workflow-verify-build = "gh workflow run _verify-build.yml --ref $(git rev-parse --abbrev-ref HEAD) -f package=dbt-adapters -f branch=$(git rev-parse --abbrev-ref HEAD)"
workflow-publish = "gh workflow run publish.yml --ref $(git rev-parse --abbrev-ref HEAD) -f package=dbt-adapters -f branch=$(git rev-parse --abbrev-ref HEAD) -f deploy-to=test -f pypi-internal=false -f pypi-public=true"
Expand Down

0 comments on commit 1d36766

Please sign in to comment.