Skip to content

Commit

Permalink
add internal publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Oct 18, 2024
1 parent 64cfb91 commit dee13a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/publish-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: "Publish Internally"
on:
workflow_call:
inputs:
package:
description: "Choose the package to publish"
type: string
default: "dbt-athena"
deploy-to:
description: "Choose whether to publish to test or prod"
type: string
Expand All @@ -15,7 +19,6 @@ on:
defaults:
run:
shell: bash
working-directory: ./dbt-athena

jobs:
publish:
Expand All @@ -37,15 +40,14 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- id: package
run: echo "version=$(hatch version)" >> $GITHUB_OUTPUT
working-directory: ./${{ inputs.package }}
- id: published
run: |
versions_published="$(aws codeartifact list-package-versions \
--domain-owner ${{ secrets.AWS_ACCOUNT_ID }} \
--domain ${{ vars.AWS_DOMAIN }} \
--repository ${{ vars.AWS_REPOSITORY }} \
--region ${{ vars.AWS_REGION }} \
--format pypi \
--package dbt-athena \
--package ${{ inputs.package }} \
--output json \
--query 'versions[*].version' | jq -r '.[]' | grep "^${{ steps.package.outputs.version }}" || true )" # suppress pipefail only here
echo "versions=$(echo "${versions_published[*]}"| tr '\n' ',')" >> $GITHUB_OUTPUT
Expand All @@ -60,15 +62,16 @@ jobs:
hatch run build:check-all
export TWINE_PASSWORD=$(aws codeartifact get-authorization-token \
--domain-owner ${{ secrets.AWS_ACCOUNT_ID }} \
--domain dbt-sandbox \
--query authorizationToken \
--output text)
--domain ${{ vars.AWS_DOMAIN }} \
--output text \
--query authorizationToken)
export TWINE_REPOSITORY_URL=$(aws codeartifact get-repository-endpoint \
--domain-owner ${{ secrets.AWS_ACCOUNT_ID }} \
--domain dbt-sandbox \
--repository dbt-adapters-releases \
--domain ${{ vars.AWS_DOMAIN }} \
--repository ${{ vars.AWS_REPOSITORY }} \
--format pypi \
--query repositoryEndpoint \
--output text)
--output text \
--query repositoryEndpoint)
twine upload dist/*
working-directory: ./${{ inputs.package }}
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ on:
description: "Choose the branch to release from"
type: string
default: "main"
pypi-public:
description: "Deploy to PyPI - Public"
type: boolean
default: false
pypi-internal:
description: "Deploy to PyPI - Internal"
description: "Publish Internally"
type: boolean
default: true
pypi-public:
description: "Publish to PyPI"
type: boolean
default: false

# don't attempt to release the same target in parallel
concurrency:
Expand All @@ -43,6 +43,7 @@ jobs:
needs: [unit-tests, integration-tests]
uses: ./.github/workflows/publish-internal.yml
with:
deploy-to: ${{ inputs.deploy-to }}
branch: ${{ inputs.branch }}

publish-pypi:
Expand Down

0 comments on commit dee13a7

Please sign in to comment.