-
Notifications
You must be signed in to change notification settings - Fork 153
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-bigquery contributing guide. |
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" | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
- 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-last-successful-run.outputs.commit_sha }}" | jq -r .published_at) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to retrieve commits not releases (i.e. we may not have a github release yet). Looks like this could work:
https://api.github.com/repos/dbt-labs/dbt-bigquery/commits/2c77893d0fb7b5d76ba85cc16712b9563a60329b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating this more this morning i'm starting to wonder if this should be its own action that triggers our current workflow to supply the fields we need that way. thoughts?
- name: Get last successful Release to Cloud run details | ||
id: get_last_successful_release_run | ||
run: | | ||
last_run_url=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runs?event=workflow_dispatch&status=success&branch=${{ github.ref }}&workflow_file=release.internal.yml" | jq -r '.workflow_runs[0].url') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is pretty clever
question: should this be just releasing automatically off main or for every "supported" version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're mostly there, just a few nits and catches.
echo "Last run URL: $last_run_url" | ||
commit_sha=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $last_run_url | jq -r '.head_sha') | ||
echo "Commit SHA: $commit_sha" | ||
echo "::set-output name=commit_sha::$commit_sha" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be the new syntax that uses >> GITHUB_OUTPUT
. I forget what it is off the top of my head, but it's something like echo "set commit_sha=$commit_sha" >> GITHUB_OUTPUT
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "supported" version? I think we're only ever releasing off |
run: | | ||
last_run_url=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runs?event=workflow_dispatch&status=success&branch=main&workflow_file=release-internal.yml" | jq -r '.workflow_runs[0].url') | ||
echo "Last run URL: $last_run_url" | ||
commit_sha=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $last_run_url | jq -r '.head_sha') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way this can be None
? Might be nice to validate and exit here if it's empty.
# Get last successful Release to Cloud run details | ||
last_run_url=$(curl --silent -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runs?event=workflow_dispatch&status=success&branch=main&workflow_file=release-internal.yml" | jq -r '.workflow_runs[0].url') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/dbt-labs/adapters-team-private/issues/168
docs dbt-labs/docs.getdbt.com/#
Problem
manually having to kick off the internal release workflow is a time eater, we can try to automate it as much as possible and just check it in the start of day.
Solution
add a cron job call for early mornings on a specified day a week (currently weds) and have the workflow first compare commit to last release if there is a new commit continue with release else don't.
Checklist