diff --git a/.github/actions/audit-changelog/action.yml b/.github/actions/audit-changelog/action.yml deleted file mode 100644 index 8599f112..00000000 --- a/.github/actions/audit-changelog/action.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: "Audit changelog" -description: "Get metadata about a changelog" - -inputs: - version: - description: "The version whose changelog is being audited" - required: true - -outputs: - path: - description: "The expected file path to the change log, relative to the repo root" - value: ${{ steps.path.outputs.path }} - exists: - description: "Indicates if the changelog exists" - value: ${{ steps.exists.outputs.exists }} - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo version : ${{ inputs.version }} - - - name: "Parse version: `${{ inputs.version }}`" - id: semver - uses: dbt-labs/actions/parse-semver@v1.1.0 - with: - version: ${{ inputs.version }} - - - name: "Set: path" - id: path - shell: bash - run: | - path=".changes/${{ steps.semver.outputs.base-version }}" - if [[ ${{ steps.semver.outputs.is-pre-release }} -eq 1 ]]; then - path+="-${{ steps.semver.outputs.pre-release }}" - fi - path+=".md" - echo "path=$path" >> $GITHUB_OUTPUT - - - name: "Set: exists" - id: exists - shell: bash - run: | - exists=false - if test -f ${{ steps.path.outputs.path }}; then - exists=true - fi - echo "exists=exists">> $GITHUB_OUTPUT - - - name: "[DEBUG] Changelog metadata" - shell: bash - run: | - echo version : ${{ inputs.version }} - echo path : ${{ steps.path.outputs.path }} - echo exists : ${{ steps.exists.outputs.exists }} diff --git a/.github/actions/audit-github-commit/action.yml b/.github/actions/audit-github-commit/action.yml deleted file mode 100644 index 8a0ab35d..00000000 --- a/.github/actions/audit-github-commit/action.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: "Audit GitHub commit" -description: "Get metadata about a commit" - -inputs: - sha: - description: "The commit to audit" - required: true - -outputs: - tag: - description: "The associated release tag, if the release exists" - value: ${{ steps.commit.outputs.tag_name }} - release-id: - description: "The associated release id, if the release exists" - value: ${{ steps.commit.outputs.id }} - pre-release: - description: "If the associated release exists, is it a pre-release?" - value: ${{ steps.commit.outputs.prerelease }} - commitish: - description: "The associated commitish, if the release exists" - value: ${{ steps.commit.outputs.target_commitish }} - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo sha : ${{ inputs.sha }} - - - name: "Check if a release exists for `${{ inputs.sha }}`" - id: commit - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: cardinalby/git-get-release-action@1.2.4 - with: - commitSha: ${{ inputs.sha }} - doNotFailIfNotFound: true # returns blank outputs when not found instead of error - searchLimit: 15 # Since we only care about recent releases, speed up the process - - - name: "[DEBUG] Commit metadata" - shell: bash - run: | - echo sha : ${{ inputs.sha }} - echo tag : ${{ steps.commit.outputs.tag_name }} - echo release-id : ${{ steps.commit.outputs.id }} - echo pre-release : ${{ steps.commit.outputs.prerelease }} - echo commitish : ${{ steps.commit.outputs.target_commitish }} diff --git a/.github/actions/audit-github-tag/action.yml b/.github/actions/audit-github-tag/action.yml deleted file mode 100644 index deeaaeca..00000000 --- a/.github/actions/audit-github-tag/action.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: "Audit GitHub tag" -description: "Get metadata about a release tag" - -inputs: - tag: - description: "The tag to audit (e.g. v1.0.0b1)" - required: true - repo-url: - description: "The URL to the repo (e.g. https://github.com/dbt-labs/dbt-adapters)" - required: true - -outputs: - exists: - description: "Indicates if the tag exists" - value: ${{ steps.tag.outputs.exists }} - sha: - description: "The commit associated with the tag if the tag exists" - value: ${{ steps.commit.outputs.sha }} - is-draft: - description: "If the tag exists, indicates if it is a draft" - value: ${{ steps.draft.outputs.is-draft }} - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo tag : ${{ inputs.tag }} - echo repo-url : ${{ inputs.repo-url }} - - - name: "Set: exists" - id: tag - shell: bash - run: | - output=$((gh release view ${{ inputs.tag }} --json isDraft,targetCommitish --repo ${{ inputs.repo-url }}) 2>&1) || true - echo "results=$output" >> $GITHUB_OUTPUT - if [[ "$output" == "release not found" ]]; then - echo "exists=false" >> $GITHUB_OUTPUT - else - echo "exists=true" >> $GITHUB_OUTPUT - fi - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: "Set: sha" - id: commit - if: ${{ fromJSON(steps.tag.outputs.exists) == true }} - shell: bash - run: | - sha=$(jq -r '.targetCommitish' <<< "${{ steps.tag.outputs.results }}") - echo "sha=$sha" >> $GITHUB_OUTPUT - - - name: "Set: is-draft" - id: draft - if: ${{ fromJSON(steps.tag.outputs.exists) == true }} - shell: bash - run: | - is-draft=$(jq -r '.isDraft' <<< "${{ steps.tag.outputs.results }}") - if [[ $is-draft == true ]]; then - echo "is-draft=true" >> $GITHUB_OUTPUT - else - echo "is-draft=false" >> $GITHUB_OUTPUT - fi - - - name: "[DEBUG] Tag metadata" - shell: bash - run: | - echo tag : ${{ inputs.tag }} - echo repo-url : ${{ inputs.repo-url }} - echo exists: : ${{ steps.release.outputs.exists }} - echo sha : ${{ steps.commit.outputs.sha }} - echo is-draft : ${{ steps.draft.outputs.is-draft }} diff --git a/.github/actions/audit-github-team/action.yml b/.github/actions/audit-github-team/action.yml deleted file mode 100644 index f04d09bf..00000000 --- a/.github/actions/audit-github-team/action.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: "Audit GitHub team" -description: "Get metadata about a GitHub team" - -inputs: - organization: - description: "The GitHub organization that owns the team" - default: "dbt-labs" - team: - description: "The name of the team" - required: true - -outputs: - members: - description: "A space delimited list of team members" - value: ${{ steps.members.outputs.membership }} - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo organization : ${{ inputs.organization }} - echo team : ${{ inputs.team }} - - - name: "Create output file name" - id: output-file - shell: bash - run: echo "name=output_$GITHUB_RUN_ID.json" >> $GITHUB_OUTPUT - - - name: "Get team membership" - shell: bash - run: | - url = orgs/${{ inputs.organization }}/teams/${{ inputs.team }}/members - header = Accept: application/vnd.github+json - gh api -H "$header" $url > ${{ steps.output-file.outputs.name }} - - - name: "Parse team membership" - id: members - shell: bash - run: | - team_list=$(jq -r '.[].login' ${{ steps.output-file.outputs.name }}) - team_list_single=$(echo $team_list | tr '\n' ' ') - echo "membership=$team_list_single" >> $GITHUB_OUTPUT - - - name: "Delete the output file" - shell: bash - run: rm ${{ steps.output-file.outputs.name }} - - - name: "[DEBUG] Parse team membership" - shell: bash - run: | - echo organization : ${{ inputs.organization }} - echo team : ${{ inputs.team }} - echo members : ${{ steps.members.outputs.membership }} diff --git a/.github/actions/build-artifacts/action.yml b/.github/actions/build-artifacts/action.yml deleted file mode 100644 index 8b7acb90..00000000 --- a/.github/actions/build-artifacts/action.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: "Build artifacts" -description: "Build artifacts using `hatch` as the default build frontend" - -inputs: - build-command: - description: "The command to build distributable artifacts" - default: "hatch build" - check-command: - description: "The command to check built artifacts" - default: "hatch run build:check-all" - archive-name: - description: "Name for the GitHub archive for uploading built artifacts, leave blank for no upload" - default: "" - archive-retention: - description: "Duration in days to keep the GitHub archive, requires `archive-name`" - default: "3" - working-dir: - description: "Where to run commands from, primarily supports namespace packaging" - default: "./" - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo build-command : ${{ inputs.build-command }} - echo check-command : ${{ inputs.check-command }} - echo archive-name : ${{ inputs.archive-name }} - echo archive-retention : ${{ inputs.archive-retention }} - echo working-dir : ${{ inputs.working-dir }} - - - name: "Build artifacts" - shell: bash - working-directory: ${{ inputs.working-dir }} - run: ${{ inputs.build-command }} - - - name: "[INFO] Built artifacts" - shell: bash - working-directory: ${{ inputs.working-dir }} - run: | - title="Built artifacts" - message=$(ls ./dist) - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - - - name: "Check artifacts" - shell: bash - working-directory: ${{ inputs.working-dir }} - run: ${{ inputs.check-command }} - - - name: "Upload artifacts" - if: ${{ !inputs.archive-name == '' }} - uses: actions/upload-artifact@v4 - with: - name: ${{ inputs.archive-name }} - path: ${{ inputs.working-dir }}dist/ - retention-days: ${{ inputs.archive-retention }} - - - name: "[INFO] Uploaded artifacts" - if: ${{ !inputs.archive-name == '' }} - shell: bash - run: | - title="Uploaded artifacts" - message="Uploaded artifacts to ${{ inputs.archive-name }}" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" diff --git a/.github/actions/create-temp-branch/action.yml b/.github/actions/create-temp-branch/action.yml deleted file mode 100644 index 6fe53ceb..00000000 --- a/.github/actions/create-temp-branch/action.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Create temp branch" -description: "Create a unique temporary branch for running CI workflows, such as version bumps, changelog consolidation, etc." - -inputs: - branch-stub: - description: "Stub to use for naming the branch (e.g. prep-release/, nightly-release/, etc.)" - default: "temp/" - -outputs: - branch: - description: "Name of the newly created branch" - value: ${{ steps.branch.outputs.branch-name }} - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo branch-stub : ${{ inputs.branch-stub }} - - - name: "Create a unique branch name" - id: branch - shell: bash - run: | - name="${{ inputs.branch-stub }}" - name+="$(date +'%Y-%m-%d')/$GITHUB_RUN_ID" - echo "branch-name=$name" >> $GITHUB_OUTPUT - - - name: "Create branch: `${{ steps.branch.outputs.branch-name }}`" - shell: bash - run: | - git checkout -b ${{ steps.branch.outputs.branch-name }} - git push -u origin ${{ steps.branch.outputs.branch-name }} - - - name: "[INFO] Created branch" - shell: bash - run: | - title="Created branch" - message="${{ steps.branch.outputs.branch-name }}" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" diff --git a/.github/actions/github-commit/action.yml b/.github/actions/github-commit/action.yml deleted file mode 100644 index 0ecab9fb..00000000 --- a/.github/actions/github-commit/action.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: "Commit changes" -description: "Commit changes and push back up to the remote" - -inputs: - message: - description: "The commit message" - required: true - user: - description: "The user for the commit" - default: "Github Build Bot" - email: - description: "The email for the commit" - default: "buildbot@fishtownanalytics.com" - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo message : ${{ inputs.message }} - echo user : ${{ inputs.user }} - echo email : ${{ inputs.email }} - - - name: "Commit and push changes" - shell: bash - run: | - git config user.name "${{ inputs.user }}" - git config user.email "${{ inputs.email }}" - git pull - git add . - git commit -m "[automated] ${{ inputs.message }}" - git push - - - name: "[INFO] Committed and pushed changes" - shell: bash - run: | - title="Committed and pushed changes" - message="Committed and pushed changes back up to remote" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" diff --git a/.github/actions/github-merge/action.yml b/.github/actions/github-merge/action.yml deleted file mode 100644 index efe7464c..00000000 --- a/.github/actions/github-merge/action.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: "Merge GitHub branch" -description: "Merge one branch into another on GitHub" - -inputs: - source-branch: - description: "The source branch to be merged" - required: true - target-branch: - description: "The target branch to receive the merge" - required: true - message: - description: "Commit message for the merge" - required: true - delete-source-branch: - description: "Will delete the source branch after merging" - default: "true" - -outputs: - sha: - description: "The commit SHA for the merge" - value: ${{ steps.merge-sha.outputs.sha }} - -runs: - using: composite - steps: - # TODO: are we comfortable passing our bot token to this third party action? - - name: "Merge `${{ inputs.source-branch }}` into `${{ inputs.target-branch }}`" - uses: everlytic/branch-merge@1.1.5 - with: - source_ref: ${{ inputs.source-branch }} - target_branch: ${{ inputs.target-branch }} - commit_message_template: "[automated] ${{ inputs.message }}" - github_token: ${{ secrets.FISHTOWN_BOT_PAT }} - - - name: "Checkout `${{ inputs.branch }}`" - uses: actions/checkout@v3 - with: - ref: ${{ inputs.target-branch }} - - # TODO: see if everlytic/branch-merge has outputs that have this information - - name: "Get commit SHA for the merge" - id: merge-sha - shell: bash - run: | - git pull - echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - - # TODO: see if everlytic/branch-merge has options to do this - - name: "Delete `${{ inputs.source-branch }}`" - if: ${{ fromJSON(inputs.delete-source-branch) }} - shell: bash - run: git push origin -d ${{ inputs.source-branch }} - - - name: "[INFO] Merged changes" - shell: bash - run: | - title="Merged changes" - message="${{ inputs.source-branch }} was merged into ${{ inputs.target-branch }} with sha ${{ steps.merge-sha.outputs.sha }}" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" diff --git a/.github/actions/log-info/action.yml b/.github/actions/log-info/action.yml deleted file mode 100644 index f6ea0cdc..00000000 --- a/.github/actions/log-info/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: "Raise a notification" -description: "Raises a notification to the workflow summary in a standardized pattern" - -inputs: - title: - description: "The notification title" - required: true - message: - description: "The detailed message" - required: true - prefix: - description: "The parent process raising the notification" - default: "INFO" - -runs: - using: composite - steps: - - shell: bash - run: 'echo "::notice title=$TITLE::$MESSAGE"' - env: - TITLE: "[${{ inputs.prefix }}]: ${{ inputs.title }}" - MESSAGE: ${{ inputs.message }} diff --git a/.github/actions/publish-github-draft/action.yml b/.github/actions/publish-github-draft/action.yml deleted file mode 100644 index 8506d94b..00000000 --- a/.github/actions/publish-github-draft/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: "Publish GitHub draft release as full release" -description: "Publish an existing draft release as a non-draft release" - -inputs: - tag: - description: "The tag to publish (i.e. v1.0.0b1)" - required: true - repo-url: - description: "The URL to the repo (https://github.com/dbt-labs/dbt-adapters" - required: true - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo tag : ${{ inputs.tag }} - echo repo-url : ${{ inputs.repo-url }} - - - name: "Publish `${{ inputs.tag }}` as full release" - shell: bash - run: gh release edit ${{ inputs.tag }} --repo ${{ inputs.repo-url }} --draft=false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: "[INFO] Published draft as full release" - shell: bash - run: | - title="Released draft as non-draft release on GitHub" - message="tag: ${{ inputs.tag }} repo: ${{ inputs.repo-url }}" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" diff --git a/.github/actions/publish-github/action.yml b/.github/actions/publish-github/action.yml deleted file mode 100644 index 6042357c..00000000 --- a/.github/actions/publish-github/action.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: "Publish to GitHub as draft release" -description: "Publish artifacts from an archive to GitHub as a draft release" - -inputs: - archive-name: - description: "Name of the archive containing the artifacts, leave blank if local" - default: "" - tag: - description: "The release tag to publish under" - required: true - repo-url: - description: "The URL to the repo (e.g. https://github.com/dbt-labs/dbt-adapters)" - required: true - sha: - description: "Commit SHA being released" - required: true - changelog-path: - description: "Path to the release notes" - required: true - is-draft: - description: "Indicates that this is a draft release" - required: true - -runs: - using: composite - steps: - - name: "Set: pre-release" - id: pre-release - shell: bash - run: | - if ${{ contains(inputs.tag, 'rc') || contains(inputs.tag, 'b') || contains(inputs.tag, 'a' || contains(inputs.tag, 'dev') }} - then - echo "pre-release=--prerelease" >> $GITHUB_OUTPUT - fi - - - name: "Set: draft" - id: draft - shell: bash - run: | - if ${{ fromJSON(inputs.is-draft) }} - then - echo "draft=--draft" >> $GITHUB_OUTPUT - fi - - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo archive-name : ${{ inputs.archive-name }} - echo tag : ${{ inputs.tag }} - echo repo-url : ${{ inputs.repo-url }} - echo sha : ${{ inputs.sha }} - echo changelog-path : ${{ inputs.changelog-path }} - echo is-draft : ${{ inputs.is-draft }} - echo pre-release : ${{ steps.pre-release.outputs.pre-release }} - echo draft : ${{ steps.draft.outputs.draft }} - - - name: "Download artifacts from `${{ inputs.archive-name }}`" - if: ${{ !(inputs.archive-name == "" }} - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.archive-name }} - path: dist/ - - - name: "[INFO] Downloaded artifacts" - if: ${{ !(inputs.archive-name == "" }} - uses: ./.github/actions/log-info - with: - title: "Downloaded artifacts" - message: "${{ inputs.archive-name }} contained: $(ls ./dist)" - prefix: ${{ env.NOTIFICATION_PREFIX }} - - - name: "Publish artifacts to GitHub as draft release" - shell: bash - run: gh release create $TAG $ARTIFACTS --repo $REPO --title "$TITLE" --notes-file $RELEASE_NOTES --target $COMMIT $PRERELEASE $DRAFT - env: - TAG: ${{ inputs.tag }} - ARTIFACTS: "./dist/*" - REPO: ${{ inputs.repo-url }} - TITLE: ${{ github.event.repository.name }} ${{ inputs.tag }} - RELEASE_NOTES: ${{ inputs.changelog-path }} - COMMIT: ${{ inputs.sha }} - PRERELEASE: ${{ steps.pre-release.outputs.pre-release }} - DRAFT: ${{ steps.draft.outputs.draft }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: "[INFO] Published artifacts to GitHub as draft release" - uses: ./.github/actions/log-info - with: - title: "Published artifacts to GitHub as draft release" - message: "tag: ${{ inputs.tag }} pre-release: ${{ steps.pre-release.outputs.pre-release }} artifacts: $(ls ./dist)" - prefix: ${{ env.NOTIFICATION_PREFIX }} diff --git a/.github/actions/publish-pypi/action.yml b/.github/actions/publish-pypi/action.yml deleted file mode 100644 index 472b42ca..00000000 --- a/.github/actions/publish-pypi/action.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: "Publish to PyPI" -description: "Publish artifacts from an archive to PyPI" - -inputs: - archive-name: - description: "Name of the archive containing the artifacts, leave blank if local" - default: "" - index-url: - description: "The url for the PyPI index" - required: true - working-dir: - description: "Where to run commands from, primarily supports namespace packaging" - default: "./" - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo archive-name : ${{ inputs.archive-name }} - echo index-url : ${{ inputs.index-url }} - echo working-dir : ${{ inputs.working-dir }} - - - name: "Download artifacts from `${{ inputs.archive-name }}`" - if: ${{ !(inputs.archive-name == "" }} - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.archive-name }} - path: dist/ - - - name: "[INFO] Downloaded artifacts" - if: ${{ !(inputs.archive-name == "" }} - shell: bash - run: | - title="Downloaded artifacts" - message="Downloaded artifacts from ${{ inputs.archive-name }}" - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" - - - name: "[DEBUG] Found artifacts" - shell: bash - working-directory: ${{ inputs.working-dir }} - run: echo $(ls ./dist) - - - name: "Publish artifacts to PyPI" - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: ${{ inputs.index-url }} - packages-dir: ${{ inputs.working-dir }}dist/ - - - name: "[INFO] Published artifacts to PyPI" - shell: bash - working-directory: ${{ inputs.working-dir }} - run: | - title="Published artifacts to PyPI" - message=$(ls ./dist) - echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" diff --git a/.github/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml deleted file mode 100644 index d75e4788..00000000 --- a/.github/actions/setup-environment/action.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: "Setup environment" -description: "Setup a python environment with `hatch` as the default build frontend" - -inputs: - python-version: - description: "The version of python to install" - default: "3.8" - setup-build-command: - description: "The command to setup build dependencies" - default: "python -m pip install hatch" - -runs: - using: composite - steps: - - name: "[DEBUG] Inputs" - shell: bash - run: | - echo python-version : ${{ inputs.python-version }} - echo setup-build-command : ${{ inputs.setup-build-command }} - - - name: "Set up python ${{ inputs.python-version }}" - uses: actions/setup-python@v5 - with: - python-version: ${{ inputs.python-version }} - - - name: "Install build dependencies" - shell: bash - run: ${{ inputs.setup-build-command }} - - - name: "Add `linuxbrew` to PATH" - shell: bash - run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH - - - name: "Install `changie`" - shell: bash - run: | - brew tap miniscruff/changie https://github.com/miniscruff/changie - brew install changie diff --git a/.github/workflows/build-artifacts.yml b/.github/workflows/build-artifacts.yml index 13e08bbb..0da8c151 100644 --- a/.github/workflows/build-artifacts.yml +++ b/.github/workflows/build-artifacts.yml @@ -2,111 +2,63 @@ name: "Build artifacts" run-name: "Build `${{ inputs.package }}==${{ inputs.version}}` from `${{ inputs.branch }}` for deployment to `${{ deploy-environment }}`" on: - workflow_call: - inputs: - branch: - description: "The branch being used to build the package" - type: string - default: "main" - package: - description: "The name of the package being built" - type: string - version: - description: "The release version number (i.e. 1.0.0b1)" - type: string - required: true - deploy-environment: - description: "The environment where this package will be deployed" - type: string - default: "prod" - outputs: - archive-name: ${{ jobs.calculated-inputs.outputs.archive-name }} - workflow_dispatch: - inputs: - branch: - description: "The branch being used to build the package" - type: string - default: "main" - package: - description: "The name of the package being built" - type: choice - options: - - "dbt-adapters" - - "dbt-tests-adapter" - version: - description: "The release version number (i.e. 1.0.0b1)" - type: string - required: true - deploy-environment: - description: "The environment where this package will be deployed" - type: environment + workflow_call: + inputs: + package: + description: "The package being built" + type: string + branch: + description: "The branch to use to build the artifacts" + type: string + default: "main" + outputs: + archive-name: + value: ${{ jobs.build-artifacts.outputs.archive-name }} + description: "The name used for the upload archive" + type: string + working-directory: + value: ${{ jobs.build-artifacts.outputs.working-directory }} + description: "The working directory for the package" + type: string permissions: read-all # don't try to build the same version of the same package, the archive name could collide concurrency: - group: ${{ github.workflow }}-${{ inputs.package }}-${{ inputs.version }}-${{ inputs.deploy-environment }} - cancel-in-progress: true - -defaults: - run: - shell: bash + group: "${{ github.workflow }}-${{ inputs.package }}-${{ inputs.version }}-${{ inputs.deploy-environment }}" + cancel-in-progress: true env: - NOTIFICATION_PREFIX: "[Build]" + NOTIFICATION_PREFIX: "Build artifacts" jobs: - calculated-inputs: - name: "Calculated inputs" - runs-on: ubuntu-latest - outputs: - archive-name: ${{ steps.archive.outputs.name }} - working-dir: ${{ steps.working-dir.outputs.path }} - steps: - - name: "Set: archive-name" - id: archive - shell: bash - run: | - name=${{ inputs.package }}-${{ inputs.version }}-${{ inputs.deploy-environment }} - echo "name=$name" >> $GITHUB_OUTPUT - - - name: "Set: working-dir" - id: working-dir - shell: bash - run: | - if [[ ${{ inputs.package }} == "dbt-tests-adapter" ]] - then - path="./dbt-tests-adapter/" - else - path="./" - fi - echo "path=$path" >> $GITHUB_OUTPUT - - - name: "[DEBUG] Inputs" - run: | - echo package : ${{ inputs.package }} - echo branch : ${{ inputs.branch }} - echo version : ${{ inputs.version }} - echo deploy-environment : ${{ inputs.deploy-environment }} - echo archive-name : ${{ steps.archive.outputs.name }} - echo working-dir : ${{ steps.working-dir.outputs.path }} - echo NOTIFICATION_PREFIX : ${{ env.NOTIFICATION_PREFIX }} - - build: - name: "Build the artifacts" - needs: [calculated-inputs] - runs-on: ubuntu-latest - steps: - - name: "Check out `${{ inputs.branch }}`" - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} + build-artifacts: + name: "Build artifacts" + runs-on: ubuntu-latest + outputs: + archive-name: ${{ steps.archive.outputs.name }} + working-directory: ${{ steps.working-directory.outputs.path }} + steps: + - name: "Set: archive-name" + id: archive + shell: bash + run: | + name=${{ inputs.package }}-${{ inputs.version }}-${{ inputs.deploy-environment }} + echo "name=$name" >> $GITHUB_OUTPUT - - name: "Setup `hatch`" - uses: ./.github/actions/setup-environment + - name: "Set: working-directory" + id: working-directory + shell: bash + run: | + if [[ ${{ inputs.package }} == "dbt-tests-adapter" ]]; then + path="./dbt-tests-adapter/" + else + path="./" + fi + echo "path=$path" >> $GITHUB_OUTPUT - - name: "Build `${{ inputs.package }}`" - uses: ./.github/actions/build - with: - archive-name: ${{ needs.calculated-inputs.outputs.archive-name }} - working-dir: ${{ needs.calculated-inputs.outputs.working-dir }} + - name: "Build artifacts" + uses: dbt-labs/actions/hatch/artifacts/create.yml@add-hatch-actions + with: + archive-name: ${{ steps.archive.outputs.name }} + working-directory: ${{ needs.working-directory.outputs.path }}