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

feat(actions): add reusable actions, release cleanup #354

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

josefaidt
Copy link
Contributor

@josefaidt josefaidt commented Nov 15, 2022

Issue #, if available:

Description of changes:

  • adds composite actions:
    • cleanup-discarded-release cleans up discarded release artifacts such as branches and draft releases
    • extract-version-from-branch extracts a version from a branch name (e.g. release/v1.0.0 -> v1.0.0)
  • adds cleanup-discarded-release workflow to trigger composite action
  • modifies create-release workflow to:
    • create the draft release in GitHub
    • post the release notes in the PR
    • run a cleanup job on failure (if a failure were to occur -- not likely)
  • modifies release workflow to use composite action extract-version-from-branch
  • migrate all workflows to use .yaml

image

diagram of changes to workflow
flowchart TB
    workflowCreateRelease[dev executes workflow <code>create-release</code>]
    subgraph runWorkflowCreateRelease[<code>create-release</code>]
        stepIsPrerelease[is prerelease?]
        stepSetVersion[set version]
        stepSetVersionPre[set next version]
        stepBranchCreate[create release branch]
        stepBranchPush[push to release branch]
        stepDraftReleaseCreate[create draft release]
        stepPROpen[open release PR with release notes]

        stepIsPrerelease-->|yes|stepSetVersionPre
        stepIsPrerelease-->|no|stepSetVersion
        stepSetVersionPre-->stepBranchCreate
        stepSetVersion-->stepBranchCreate
        stepBranchCreate-->stepBranchPush
        stepBranchPush-->stepDraftReleaseCreate
        stepDraftReleaseCreate-->stepPROpen
    end
    %% connect dev to GitHub workflow
    workflowCreateRelease-->runWorkflowCreateRelease

    releaseApproved[approved and merge]
    releaseRejected[rejected and close]

    runWorkflowCreateRelease-->|LGTM, 2 approvers|releaseApproved
    runWorkflowCreateRelease-->releaseRejected

    subgraph runWorkflowCleanup[<code>cleanup-discarded-release</code> workflow]
        stepWorkflowCleanup_ExtractVersion[read version from branch name]
        stepWorkflowCleanup_ExtractVersion-->|run action|runActionCleanup
    end

    subgraph runActionCleanup[<code>cleanup-discarded-release</code> action]
        stepActionCleanup_TryDeleteBranch[delete release branch]
        stepActionCleanup_TryDeleteRelease[delete release]
        stepActionCleanup_TryDeleteBranch-->stepActionCleanup_TryDeleteRelease
    end

    runWorkflowReleaseEnvNext[run <code>release-env</code> workflow for next]
    runWorkflowReleaseEnvMain[run <code>release-env</code> workflow for main]

    subgraph runWorkflowRelease[<code>release</code> workflow]
        stepWorkflowRelease_VerifyRun[verify run]
        stepWorkflowRelease_ExtractVersion[read version from branch name]
        stepWorkflowRelease_isPreRelease[is prerelease?]

        stepWorkflowRelease_VerifyRun-->stepWorkflowRelease_ExtractVersion
        stepWorkflowRelease_ExtractVersion-->|run release-env for next|runWorkflowReleaseEnvNext
        runWorkflowReleaseEnvNext-->stepWorkflowRelease_isPreRelease
        stepWorkflowRelease_isPreRelease-->|no|runWorkflowReleaseEnvMain
        %% stepWorkflowRelease_ExtractVersion-->|run release-env for main|runWorkflowReleaseEnv
    end

    %% subgraph runWorkflowReleaseEnvNext[<code>release-env</code> workflow for staging]
    %%     %% stepWorkflowReleaseEnv_
    %% end
    %% subgraph runWorkflowReleaseEnvMain[<code>release-env</code> workflow for production]
    %%     %% stepWorkflowReleaseEnv_
    %% end

    releaseRejected-->|run workflow|runWorkflowCleanup
    releaseApproved-->|run workflow|runWorkflowRelease
    done
    %% set this outside the subgraph
    stepWorkflowRelease_isPreRelease-->|yes|done
    runWorkflowReleaseEnvMain-->done
    runWorkflowCleanup-->done
Loading

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@josefaidt josefaidt requested a review from a team November 15, 2022 01:48
@josefaidt josefaidt added the run-ci Label to trigger action run for CI label Nov 15, 2022
@github-actions github-actions bot removed the run-ci Label to trigger action run for CI label Nov 15, 2022
@josefaidt josefaidt added the run-ci Label to trigger action run for CI label Nov 15, 2022
@github-actions github-actions bot removed the run-ci Label to trigger action run for CI label Nov 15, 2022
@josefaidt josefaidt temporarily deployed to ci November 15, 2022 01:54 Inactive
@josefaidt josefaidt added area: infra Issue pertains to infrastructure (CDK) run-ci Label to trigger action run for CI labels Nov 18, 2022
@josefaidt josefaidt removed the run-ci Label to trigger action run for CI label Nov 21, 2022
@josefaidt josefaidt added the run-ci Label to trigger action run for CI label Mar 2, 2023
@github-actions github-actions bot removed the run-ci Label to trigger action run for CI label Mar 2, 2023
@josefaidt josefaidt temporarily deployed to ci March 2, 2023 02:59 — with GitHub Actions Inactive
@josefaidt josefaidt requested review from a team and removed request for a team May 2, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: infra Issue pertains to infrastructure (CDK)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant