Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update publish.yml #614

Merged
merged 17 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions .github/workflows/_publish-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ defaults:
run:
shell: bash

env:
TEMP_PROFILE_NAME: "temp_aws_profile"

jobs:
package:
uses: ./.github/workflows/_package-directory.yml
Expand All @@ -59,11 +62,15 @@ jobs:
with:
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
- uses: pypa/hatch@install
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: "Configure AWS profile for upload"
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} --profile ${{ env.TEMP_PROFILE_NAME }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} --profile ${{ env.TEMP_PROFILE_NAME }}
aws configure set region ${{ vars.AWS_REGION }} --profile ${{ env.TEMP_PROFILE_NAME }}
aws configure set output text --profile ${{ env.TEMP_PROFILE_NAME }}
aws codeartifact login --tool twine --repository ${{ vars.AWS_REPOSITORY }} \
--domain ${{ vars.AWS_DOMAIN }} --domain-owner ${{ secrets.AWS_DOMAIN_OWNER }} \
--region ${{ vars.AWS_REGION }} --profile ${{ env.TEMP_PROFILE_NAME }}
- id: package
run: |
# strip the pre-release off to find all iterations of this patch
Expand Down Expand Up @@ -92,21 +99,8 @@ jobs:
- run: sed -i "/dbt-core[<>~=]/d" ./pyproject.toml
working-directory: ./${{ needs.package.outputs.directory }}
- run: |
export HATCH_INDEX_USER=${{ secrets.AWS_USER }}

export HATCH_INDEX_AUTH=$(aws codeartifact get-authorization-token \
--domain ${{ vars.AWS_DOMAIN }} \
--output text \
--query authorizationToken)

export HATCH_INDEX_REPO=$(aws codeartifact get-repository-endpoint \
--domain ${{ vars.AWS_DOMAIN }} \
--repository ${{ vars.AWS_REPOSITORY }} \
--format pypi \
--output text \
--query repositoryEndpoint)

pip install twine
hatch build --clean
hatch run build:check-all
hatch publish
twine upload --repository codeartifact dist/*
working-directory: ./${{ needs.package.outputs.directory }}
26 changes: 21 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ on:
description: "Publish to PyPI"
type: boolean
default: false
skip-integration-tests:
description: "Skip Running Integration Tests"
type: boolean
default: false

# don't publish to the same target in parallel
concurrency:
Expand All @@ -46,7 +50,9 @@ jobs:
branch: ${{ inputs.branch }}

integration-tests:
if: ${{ inputs.package != 'dbt-adapters' && inputs.package != 'dbt-tests-adapter' }}
if: |
(inputs.package != 'dbt-adapters' && inputs.package != 'dbt-tests-adapter') &&
inputs.skip-integration-tests == false
uses: ./.github/workflows/_integration-tests.yml
with:
package: ${{ inputs.package }}
Expand All @@ -59,7 +65,8 @@ jobs:
if: |
always() &&
(needs.integration-tests.result == 'skipped' || needs.integration-tests.result == 'success') &&
(needs.unit-tests.result == 'skipped' || needs.unit-tests.result == 'success')
(needs.unit-tests.result == 'skipped' || needs.unit-tests.result == 'success') &&
inputs.pypi-public == true
uses: ./.github/workflows/_generate-changelog.yml
with:
package: ${{ inputs.package }}
Expand All @@ -68,8 +75,13 @@ jobs:
secrets: inherit

publish-internal:
if: ${{ inputs.pypi-internal == true && inputs.package != 'dbt-athena-community' }}
needs: generate-changelog
if: |
always() &&
(needs.integration-tests.result == 'skipped' || needs.integration-tests.result == 'success') &&
(needs.unit-tests.result == 'skipped' || needs.unit-tests.result == 'success') &&
inputs.pypi-internal == true &&
inputs.package != 'dbt-athena-community'
needs: [unit-tests, integration-tests]
uses: ./.github/workflows/_publish-internal.yml
with:
package: ${{ inputs.package }}
Expand All @@ -84,7 +96,11 @@ jobs:
package: ${{ inputs.package }}

publish-pypi:
if: ${{ inputs.pypi-public == true }}
if: |
always() &&
(needs.integration-tests.result == 'skipped' || needs.integration-tests.result == 'success') &&
needs.generate-changelog.result == 'success' &&
inputs.pypi-public == true
needs: [package, generate-changelog]
runs-on: ${{ vars.DEFAULT_RUNNER }}
environment:
Expand Down
Loading