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

chore: use 'feat' for minor version provider upgrades #361

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/provider-upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class ProviderUpgrade {
"${{ steps.check_version.outputs.new_version == 'available' }}";
const currentVersion = "${{ steps.current_version.outputs.value }}";
const newVersion = "${{ steps.new_version.outputs.value }}";
const semanticType = "${{ steps.release.outputs.type }}";

workflow.addJobs({
upgrade: {
Expand All @@ -46,7 +47,7 @@ export class ProviderUpgrade {
steps: [
{
name: "Checkout",
uses: "actions/checkout@v2",
uses: "actions/checkout@v4",
},
{ run: "yarn install" },
{
Expand All @@ -73,19 +74,35 @@ export class ProviderUpgrade {
id: "new_version",
run: `echo "value=$(jq -r '. | to_entries[] | .value' src/version.json)" >> $GITHUB_OUTPUT`,
},
{
name: "Determine if this is a minor or patch release",
if: newerVersionAvailable,
id: "release",
env: {
CURRENT_VERSION: currentVersion,
NEW_VERSION: newVersion,
},
run: [
`CURRENT_VERSION_MINOR=$(cut -d "." -f 1 <<< "$CURRENT_VERSION")`,
`NEW_VERSION_MINOR=$(cut -d "." -f 1 <<< "$NEW_VERSION")`,
`[[ "$CURRENT_VERSION_MINOR" != "$NEW_VERSION_MINOR" ]] && IS_MINOR_RELEASE=true || IS_MINOR_RELEASE=false`,
`[[ "$IS_MINOR_RELEASE" == "true" ]] && SEMANTIC_TYPE=feat || SEMANTIC_TYPE=fix`,
`echo "is_minor=$IS_MINOR_RELEASE" >> $GITHUB_OUTPUT`,
`echo "type=$SEMANTIC_TYPE" >> $GITHUB_OUTPUT`,
].join("\n"),
},
// generate docs
{ run: "yarn compile", if: newerVersionAvailable },
{ run: "yarn docgen", if: newerVersionAvailable },

// submit a PR
{
name: "Create Pull Request",
if: newerVersionAvailable,
uses: "peter-evans/create-pull-request@v3",
with: {
"commit-message": `fix: upgrade provider from \`${currentVersion}\` to version \`${newVersion}\``,
branch: "auto/provider-upgrade",
title: `fix: upgrade provider from \`${currentVersion}\` to version \`${newVersion}\``,
"commit-message": `${semanticType}: upgrade provider from \`${currentVersion}\` to version \`${newVersion}\``,
title: `${semanticType}: upgrade provider from \`${currentVersion}\` to version \`${newVersion}\``,
body: `This PR upgrades the underlying Terraform provider to version ${newVersion}`,
labels: "automerge",
token: "${{ secrets.GH_TOKEN }}",
Expand Down
51 changes: 45 additions & 6 deletions test/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.