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

automate internal release workflow. #1276

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
33 changes: 29 additions & 4 deletions .github/workflows/release-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# When?
#
# Manual trigger.
# Manual trigger or cron job every wednesday morning.
McKnight-42 marked this conversation as resolved.
Show resolved Hide resolved

name: "Release to Cloud"
run-name: "Release to Cloud off of ${{ inputs.ref }}"
Expand All @@ -32,20 +32,45 @@ on:
required: true
default: false

schedule:
- cron: '0 13 * * 3' # Every Wednesday at 8:00 AM central time

defaults:
run:
shell: bash

jobs:
get-latest-release:
runs-on: ubuntu-latest
outputs:
latest_release: ${{ steps.get_latest_release.outputs.latest_release }}
steps:
- name: Get latest release
id: get_latest_release
run: |
latest_release=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r .tag_name)
echo "::set-output name=latest_release::$latest_release"

check-for-new-commits:
runs-on: ubuntu-latest
needs: get-latest-release
outputs:
new_commits: ${{ steps.check_new_commits.outputs.new_commits }}
steps:
- name: Check for new commits since last release
id: check_new_commits
run: |
last_release_date=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ needs.get-latest-release.outputs.latest_release }}" | jq -r .published_at)
new_commits=$(git rev-list --count --since="$last_release_date" ${{ inputs.ref }})
echo "::set-output name=new_commits::$new_commits"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to point somewhere else for this? won't internal releases be far ahead of the version releases? can we look at previous runs of this workflow and grab the commit from them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have updated workflow from this initial comment would love thoughts.

invoke-reusable-workflow:
if: needs.check-for-new-commits.output.new_commits != '0'
name: "Build and Release Internally"

uses: "dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@main"

with:
package_test_command: "${{ inputs.package_test_command }}"
dbms_name: "bigquery"
ref: "${{ inputs.ref }}"
skip_tests: "${{ inputs.skip_tests }}"

secrets: "inherit"
McKnight-42 marked this conversation as resolved.
Show resolved Hide resolved
Loading