diff --git a/.github/actions/audit-changelog/action.yml b/.github/actions/audit-changelog/action.yml index fb878fcf..8599f112 100644 --- a/.github/actions/audit-changelog/action.yml +++ b/.github/actions/audit-changelog/action.yml @@ -2,58 +2,56 @@ name: "Audit changelog" description: "Get metadata about a changelog" inputs: - version: - description: "The version whose changelog is being audited" - required: true + 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 }} + 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 }} + 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: "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: 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: "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 }} + - 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 index 852293b8..8a0ab35d 100644 --- a/.github/actions/audit-github-commit/action.yml +++ b/.github/actions/audit-github-commit/action.yml @@ -2,47 +2,47 @@ name: "Audit GitHub commit" description: "Get metadata about a commit" inputs: - sha: - description: "The commit to audit" - required: true + 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 }} + 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 }} + 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: "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 }} + - 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 index 77a8f608..deeaaeca 100644 --- a/.github/actions/audit-github-tag/action.yml +++ b/.github/actions/audit-github-tag/action.yml @@ -2,74 +2,72 @@ 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 + 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 }} + 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 }} + 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: 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: 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: "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 }} + - 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 index fdaca6ba..f04d09bf 100644 --- a/.github/actions/audit-github-team/action.yml +++ b/.github/actions/audit-github-team/action.yml @@ -2,54 +2,54 @@ 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 + 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 }} + 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 }} + 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 new file mode 100644 index 00000000..8b7acb90 --- /dev/null +++ b/.github/actions/build-artifacts/action.yml @@ -0,0 +1,65 @@ +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/setup-changie/action.yml b/.github/actions/setup-changie/action.yml deleted file mode 100644 index 55e994e1..00000000 --- a/.github/actions/setup-changie/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Setup `changie`" -description: "Setup `changie` using `linuxbrew`" - -runs: - using: composite - steps: - - 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/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml index 80433cd3..d75e4788 100644 --- a/.github/actions/setup-environment/action.yml +++ b/.github/actions/setup-environment/action.yml @@ -2,27 +2,37 @@ 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" + 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 }} + 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: "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: "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